Skip to content

Commit

Permalink
[added] Make modal portal have the dialog role (reactjs#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
claydiffrient authored Sep 21, 2016
1 parent abe88a8 commit 2e806c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/components/ModalPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ var ModalPortal = module.exports = React.createClass({
tabIndex: "-1",
onKeyDown: this.handleKeyDown,
onMouseDown: this.handleContentMouseDown,
onMouseUp: this.handleContentMouseUp
onMouseUp: this.handleContentMouseUp,
role: "dialog"
},
this.props.children
)
Expand Down
7 changes: 7 additions & 0 deletions specs/Modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ describe('Modal', function () {
unmountModal();
});

it('renders the modal content with a dialog aria role ', function () {
var child = 'I am a child of Modal, and he has sent me here...';
var component = renderModal({isOpen: true}, child);
equal(component.portal.refs.content.getAttribute('role'), 'dialog');
unmountModal();
});

it('has default props', function() {
var node = document.createElement('div');
Modal.setAppElement(document.createElement('div'));
Expand Down

0 comments on commit 2e806c7

Please sign in to comment.