From 2e806c724e8c0bbd6bc7dc49a8a2e4ba592e9ca6 Mon Sep 17 00:00:00 2001 From: Clay Diffrient Date: Wed, 21 Sep 2016 10:54:11 -0600 Subject: [PATCH] [added] Make modal portal have the dialog role (#223) closes #212 --- lib/components/ModalPortal.js | 3 ++- specs/Modal.spec.js | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/components/ModalPortal.js b/lib/components/ModalPortal.js index 22060a1b..88d9a116 100644 --- a/lib/components/ModalPortal.js +++ b/lib/components/ModalPortal.js @@ -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 ) diff --git a/specs/Modal.spec.js b/specs/Modal.spec.js index 98b74016..66453bd7 100644 --- a/specs/Modal.spec.js +++ b/specs/Modal.spec.js @@ -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'));