File tree 2 files changed +16
-0
lines changed
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({
63
63
} ,
64
64
65
65
componentWillUnmount : function ( ) {
66
+ if ( this . props . ariaHideApp ) {
67
+ ariaAppHider . show ( this . props . appElement ) ;
68
+ }
69
+
66
70
ReactDOM . unmountComponentAtNode ( this . node ) ;
67
71
document . body . removeChild ( this . node ) ;
68
72
elementClass ( document . body ) . remove ( 'ReactModal__Body--open' ) ;
Original file line number Diff line number Diff line change @@ -207,6 +207,18 @@ describe('Modal', function () {
207
207
equal ( document . body . className . indexOf ( 'ReactModal__Body--open' ) !== - 1 , false ) ;
208
208
} ) ;
209
209
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
+
210
222
it ( 'adds --after-open for animations' , function ( ) {
211
223
var modal = renderModal ( { isOpen : true } ) ;
212
224
var overlay = document . querySelector ( '.ReactModal__Overlay' ) ;
You can’t perform that action at this time.
0 commit comments