diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.effects.core.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index b08cd6cf4..15d81b4b0 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -415,9 +415,16 @@ $.extend( $.effects, { size = { width: element.width(), height: element.height() - }; + }, + active = document.activeElement; element.wrap( wrapper ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element // transfer positioning properties to the wrapper @@ -449,8 +456,18 @@ $.extend( $.effects, { }, removeWrapper: function( element ) { - if ( element.parent().is( ".ui-effects-wrapper" ) ) - return element.parent().replaceWith( element ); + var active = document.activeElement; + + if ( element.parent().is( ".ui-effects-wrapper" ) ) { + element.parent().replaceWith( element ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + } + + return element; }, |