File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -360,15 +360,14 @@ const Modal = React.createClass({
360360 let current = domUtils . activeElement ( this ) ;
361361 let focusInModal = current && domUtils . contains ( modalContent , current ) ;
362362
363- if ( this . props . autoFocus && ! focusInModal ) {
363+ if ( modalContent && this . props . autoFocus && ! focusInModal ) {
364364 this . lastFocus = current ;
365-
366365 modalContent . focus ( ) ;
367366 }
368367 } ,
369368
370369 restoreLastFocus ( ) {
371- if ( this . lastFocus ) {
370+ if ( this . lastFocus && this . lastFocus . focus ) {
372371 this . lastFocus . focus ( ) ;
373372 this . lastFocus = null ;
374373 }
@@ -382,7 +381,7 @@ const Modal = React.createClass({
382381 let active = domUtils . activeElement ( this ) ;
383382 let modal = React . findDOMNode ( this . refs . dialog ) ;
384383
385- if ( modal !== active && ! domUtils . contains ( modal , active ) ) {
384+ if ( modal && modal !== active && ! domUtils . contains ( modal , active ) ) {
386385 modal . focus ( ) ;
387386 }
388387 } ,
You can’t perform that action at this time.
0 commit comments