Skip to main content

Search and Top Navigation

#7595 closed bug (fixed)

Opened August 02, 2011 06:48PM UTC

Closed August 02, 2011 09:55PM UTC

Last modified August 30, 2011 08:43PM UTC

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:
Blocked by: Blocking:
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.

Attachments (0)
Change History (4)

Changed August 02, 2011 09:55PM UTC by Corey Frang comment:1

resolution: → fixed
status: newclosed

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

Changeset: 8108ec82dbc1c203893db18aac827b93d48cfc07

Changed August 02, 2011 09:58PM UTC by Corey Frang comment:2

Effects: Backporting 8108ec8 - Fixes #7595 - Wrapper-creating jquery-ui animations will discard any focus state during the animation - Thanks @rubyruy

Changeset: 82df6924cbb0fa080590d83b4edc6183dd05ce93

Changed August 02, 2011 10:01PM UTC by gnarf comment:3

milestone: 1.91.8.16

Changed August 30, 2011 08:43PM UTC by gnarf comment:4

#7681 is a duplicate of this ticket.