File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ var Modal = React.createClass({
6363 } ,
6464
6565 componentWillUnmount : function ( ) {
66+ if ( this . props . ariaHideApp ) {
67+ ariaAppHider . show ( this . props . appElement ) ;
68+ }
69+
6670 ReactDOM . unmountComponentAtNode ( this . node ) ;
6771 document . body . removeChild ( this . node ) ;
6872 elementClass ( document . body ) . remove ( 'ReactModal__Body--open' ) ;
Original file line number Diff line number Diff line change @@ -207,6 +207,18 @@ describe('Modal', function () {
207207 equal ( document . body . className . indexOf ( 'ReactModal__Body--open' ) !== - 1 , false ) ;
208208 } ) ;
209209
210+ it ( 'removes aria-hidden from appElement when unmounted without closing' , function ( ) {
211+ var el = document . createElement ( 'div' ) ;
212+ var node = document . createElement ( 'div' ) ;
213+ ReactDOM . render ( React . createElement ( Modal , {
214+ isOpen : true ,
215+ appElement : el
216+ } ) , node ) ;
217+ equal ( el . getAttribute ( 'aria-hidden' ) , 'true' ) ;
218+ ReactDOM . unmountComponentAtNode ( node ) ;
219+ equal ( el . getAttribute ( 'aria-hidden' ) , null ) ;
220+ } ) ;
221+
210222 it ( 'adds --after-open for animations' , function ( ) {
211223 var modal = renderModal ( { isOpen : true } ) ;
212224 var overlay = document . querySelector ( '.ReactModal__Overlay' ) ;
You can’t perform that action at this time.
0 commit comments