Skip to main content

Search and Top Navigation

#15046 closed bug (fixed)

Opened September 13, 2016 12:52PM UTC

Closed September 13, 2016 12:53PM UTC

Draggable: Incorrectly forcing blur when clicking inside a draggable but outside the handle

Reported by: scottgonzalez Owned by: scottgonzalez
Priority: minor Milestone: 1.12.1
Component: ui.draggable Version: 1.12.0
Keywords: Cc:
Blocked by: Blocking:
Description

From https://github.com/jquery/jquery-ui/pull/1730

I was running into a problem with a popup menu control in a dialog; clicks weren't working (but keyboard was working fine). It turned out that the menu was getting destroyed before the click event could fire.

>

Tracked down the issue to the way draggable blurs focused controls; it was doing the blur before it ran through the logic to figure out if the drag was actually on the handle. I've moved the blur below these checks, so it'll only blur things if it actually needs to handle the drag. Otherwise, it asserts no opinion on what should and shouldn't be focused, which seems like the way things ought to be.
Attachments (0)
Change History (1)

Changed September 13, 2016 12:53PM UTC by scottgonzalez comment:1

owner: → scottgonzalez
resolution: → fixed
status: newclosed

In [changeset:"8c66934434214ab92cbcf46240beb739154fdfbf" 8c66934]:

#!CommitTicketReference repository="" revision="8c66934434214ab92cbcf46240beb739154fdfbf"
Draggable: Fix spurious blur in dialogs on mousedown

I was running into a problem with a popup menu control in a dialog; clicks
weren't working (but keyboard was working fine). It turned out that the menu
was getting destroyed before the click event could fire.

Tracked down the issue to the way draggable blurs focused controls; it was
doing the blur before it ran through the logic to figure out if the drag was
actually on the handle. I've moved the blur below these checks, so it'll only
blur things if it actually needs to handle the drag. Otherwise, it asserts no
opinion on what should and shouldn't be focused, which seems like the way
things ought to be.

Also, added a unit test to check for the expected behavior.

Fixes #15046
Closes gh-1730