Skip to content

Commit 2e806c7

Browse files
[added] Make modal portal have the dialog role (#223)
closes #212
1 parent abe88a8 commit 2e806c7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: lib/components/ModalPortal.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ var ModalPortal = module.exports = React.createClass({
201201
tabIndex: "-1",
202202
onKeyDown: this.handleKeyDown,
203203
onMouseDown: this.handleContentMouseDown,
204-
onMouseUp: this.handleContentMouseUp
204+
onMouseUp: this.handleContentMouseUp,
205+
role: "dialog"
205206
},
206207
this.props.children
207208
)

Diff for: specs/Modal.spec.js

+7
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ describe('Modal', function () {
5858
unmountModal();
5959
});
6060

61+
it('renders the modal content with a dialog aria role ', function () {
62+
var child = 'I am a child of Modal, and he has sent me here...';
63+
var component = renderModal({isOpen: true}, child);
64+
equal(component.portal.refs.content.getAttribute('role'), 'dialog');
65+
unmountModal();
66+
});
67+
6168
it('has default props', function() {
6269
var node = document.createElement('div');
6370
Modal.setAppElement(document.createElement('div'));

0 commit comments

Comments
 (0)