Ticket #7595 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

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 3 years ago by Corey Frang

  • Status changed from new to closed
  • Resolution set to fixed

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

comment:2 Changed 3 years 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

comment:3 Changed 3 years ago by gnarf

  • Milestone changed from 1.9 to 1.8.16

comment:4 Changed 3 years ago by gnarf

#7681 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.