Wrapper-creating jquery-ui animations will discard any focus state during the animation
|Reported by:||rubyruy||Owned by:|
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.