Opened 14 years ago

Closed 9 years ago

Last modified 9 years ago

#4977 closed bug (fixed)

Droppable: tolerance, pointer - bug when pointer outside draggable

Reported by: kevin.wells Owned by:
Priority: major Milestone: 1.11.1
Component: ui.droppable Version: 1.8a1
Keywords: haspatch Cc:
Blocked by: Blocking:

Description

Use case

I have a draggable window for which the title bar acts as a handle. So it is only possible to drag the window by clicking in the title bar at the top of the window. I've set the containment of the window so it cannot be dragged outside the view port.

I have two droppable elements at the bottom of the view port, one on top of the other. The droppable elements are not as tall as the draggable. There is no way to drag the window onto the lowermost droppable.

I tried setting the tolerance of the droppable elements to pointer to resolve this problem. Even though I could move the pointer over the bottom droppable element I could not drop the window on the bottom element.

The problem occurs because the code in droppable assumes that the mouse pointer is always in the same position relative to the draggable that it was in when the user clicked the mouse to start dragging, or that it is always at the cursorAt position. This invariant does not hold when containment has been specified for the draggable and the draggable is close to the boundaries of the "container".

How to reproduce

I've attached a patch that adds a unit test to reproduce the problem.

How to fix

I've attached a patch that fixes the problem.

Attachments (2)

droppable_pointer_test.patch (1.6 KB) - added by kevin.wells 14 years ago.
droppable_pointer_fix.patch (2.5 KB) - added by kevin.wells 14 years ago.

Download all attachments as: .zip

Change History (13)

Changed 14 years ago by kevin.wells

Changed 14 years ago by kevin.wells

Attachment: droppable_pointer_fix.patch added

comment:1 Changed 13 years ago by Jörn Zaefferer

Milestone: TBD1.8
Priority: minormajor

Thanks for the patches.

comment:2 Changed 13 years ago by kevin-wells-iq4bis

I've applied this patch to tag 1.8.4 and to the master branch. You can pull it from here:

http://github.com/kevin-wells-iq4bis/jquery-ui/blob/3b7c347b03751deaae19875ff7ae1700e6455f1a

comment:3 Changed 11 years ago by Scott González

Milestone: 1.9.02.0.0

comment:4 Changed 11 years ago by mikesherov

Keywords: haspatch added
Status: newopen
Summary: tolerance, pointer - bug when pointer outside draggableDroppable: tolerance, pointer - bug when pointer outside draggable

comment:5 Changed 10 years ago by wilhol

I've submitted a pull request for this, updated to work on the current master. see https://github.com/jquery/jquery-ui/pull/991

comment:6 Changed 10 years ago by bhiggins

FWIW, I've tested the pull request at https://github.com/jquery/jquery-ui/pull/991 against v1.10.3 and it works.

What's the next step here?

comment:7 Changed 10 years ago by bhiggins

[accidental dup]

Last edited 10 years ago by bhiggins (previous) (diff)

comment:8 Changed 10 years ago by Scott González

#9655 is a duplicate of this ticket.

comment:9 Changed 9 years ago by mikesherov

Adding fiddle from the most recent duplicate http://jsfiddle.net/joshgreifer/Y6KM9/

comment:10 Changed 9 years ago by Will Holley

Resolution: fixed
Status: openclosed

Droppable: only consider pointer location with tolerance "pointer"

Fixes #4977 Closes gh-991

Changeset: 87081b855c5ded96039d16791a30ff0181fb5a9f

comment:11 Changed 9 years ago by mikesherov

Milestone: 2.0.01.11.1
Note: See TracTickets for help on using tickets.