Skip to main content

Search and Top Navigation

#4977 closed bug (fixed)

Opened November 25, 2009 02:19AM UTC

Closed August 11, 2014 01:05AM UTC

Last modified August 11, 2014 01:05AM UTC

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)
Change History (11)

Changed January 15, 2010 11:10AM UTC by jzaefferer comment:1

milestone: TBD1.8
priority: minormajor

Thanks for the patches.

Changed August 13, 2010 03:02AM UTC by kevin-wells-iq4bis comment:2

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

Changed October 11, 2012 02:49PM UTC by scottgonzalez comment:3

milestone: 1.9.02.0.0

Changed October 29, 2012 04:13AM UTC by mikesherov comment:4

keywords: → haspatch
status: newopen
summary: tolerance, pointer - bug when pointer outside draggableDroppable: tolerance, pointer - bug when pointer outside draggable

Changed May 17, 2013 04:13PM UTC by wilhol comment:5

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

Changed November 12, 2013 12:31AM UTC by bhiggins comment:6

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?

Changed November 12, 2013 12:32AM UTC by bhiggins comment:7

_comment0: FWIW, I've tested the pull request above against v1.10.3 and it works. \ \ What's the next step here? \ 1384216400508854

[accidental dup]

Changed November 12, 2013 11:30AM UTC by scottgonzalez comment:8

#9655 is a duplicate of this ticket.

Changed December 31, 2013 02:23AM UTC by mikesherov comment:9

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

Changed August 11, 2014 01:05AM UTC by Will Holley comment:10

resolution: → fixed
status: openclosed

Droppable: only consider pointer location with tolerance "pointer"

Fixes #4977

Closes gh-991

Changeset: 87081b855c5ded96039d16791a30ff0181fb5a9f

Changed August 11, 2014 01:05AM UTC by mikesherov comment:11

milestone: 2.0.01.11.1