mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Effects: Backporting 8108ec8
- Fixes #7595 - Wrapper-creating jquery-ui animations will discard any focus state during the animation - Thanks @rubyruy
This commit is contained in:
parent
4c57f361ad
commit
82df6924cb
23
ui/jquery.effects.core.js
vendored
23
ui/jquery.effects.core.js
vendored
@ -367,9 +367,16 @@ $.extend($.effects, {
|
||||
border: 'none',
|
||||
margin: 0,
|
||||
padding: 0
|
||||
});
|
||||
}),
|
||||
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
|
||||
@ -394,8 +401,18 @@ $.extend($.effects, {
|
||||
},
|
||||
|
||||
removeWrapper: function(element) {
|
||||
if (element.parent().is('.ui-effects-wrapper'))
|
||||
return element.parent().replaceWith(element);
|
||||
var parent,
|
||||
active = document.activeElement;
|
||||
|
||||
if (element.parent().is('.ui-effects-wrapper')) {
|
||||
parent = element.parent().replaceWith(element);
|
||||
// Fixes #7595 - Elements lose focus when wrapped.
|
||||
if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
|
||||
$( active ).focus();
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user