File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,18 @@ define( [ "jquery",
143143 }
144144 } ,
145145
146+ // When the popup is open, attempting to focus on an element that is not a child of the popup will redirect focus to the popup
147+ _handleDocumentFocusIn : function ( e ) {
148+ if ( this . _isOpen &&
149+ e . target !== this . _ui . container [ 0 ] &&
150+ 0 === $ ( e . target ) . parents ( ) . filter ( this . _ui . container [ 0 ] ) . length ) {
151+ this . _ui . container . focus ( ) ;
152+ e . preventDefault ( ) ;
153+ e . stopImmediatePropagation ( ) ;
154+ return false ;
155+ }
156+ } ,
157+
146158 _create : function ( ) {
147159 var ui = {
148160 screen : $ ( "<div class='ui-screen-hidden ui-popup-screen'></div>" ) ,
@@ -208,6 +220,9 @@ define( [ "jquery",
208220 resize : $ . proxy ( this , "_handleWindowResize" ) ,
209221 keyup : $ . proxy ( this , "_handleWindowKeyUp" )
210222 } ) ;
223+ this . _on ( $ ( document ) , {
224+ focusin : $ . proxy ( this , "_handleDocumentFocusIn" )
225+ } ) ;
211226 } ,
212227
213228 _applyTheme : function ( dst , theme , prefix ) {
You can’t perform that action at this time.
0 commit comments