Ticket #7595 (closed bug: fixed)
Wrapper-creating jquery-ui animations will discard any focus state during the animation
| Reported by: | rubyruy | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.8.16 |
| Component: | ui.effects.core | Version: | 1.8.14 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
This affects all recent versions of jQuery and jQuery-UI (including edge).
Initially discussed here: https://github.com/jquery/jquery-ui/pull/411
Test case here: http://jsfiddle.net/xrunt/14/
I was about to attach a fix as well but I ran into a problem. The gist of the solution is to simply record the currently focused event in $.effects.createWrapper() and $.effects.removeWrapper() and then re-focus it after DOM manipulation has occurred.
Sadly this would also trigger any registered handlers for 'focus' twice during the animation which is also undesirable and unexpected. Temporarily binding a handler with stopImmediatePropagation() almost works, but can't be guaranteed to be the first handler in the callback chain. I've fiddled with this solution here: http://jsfiddle.net/JpsUx/1/
We could either manually mess with .data('effects') or perhaps register the handler in the capture phase.
As a side node, this is the second time now I've really really wished there was a jQuery-blessed way to register something as the guaranteed first handler for something, preferably using capture if available.
Change History
comment:1 Changed 22 months ago by Corey Frang
- Status changed from new to closed
- Resolution set to fixed
comment:2 Changed 22 months ago by Corey Frang
Effects: Backporting 8108ec8 - Fixes #7595 - Wrapper-creating jquery-ui animations will discard any focus state during the animation - Thanks @rubyruy
Changeset: 82df6924cbb0fa080590d83b4edc6183dd05ce93


Effects: Adding a check to retain focused elements after wrapping and unwrapping in animations - Fixes #7595 - Wrapper-creating jquery-ui animations will discard any focus state during the animation - Thanks @rubyruy