Skip to main content

Search and Top Navigation

#9379 closed bug (fixed)

Opened June 17, 2013 08:46PM UTC

Closed December 03, 2013 03:09PM UTC

Last modified December 03, 2013 03:55PM UTC

Draggable: position bug in scrollable div

Reported by: pierrickrouxel Owned by: mikesherov
Priority: major Milestone: 1.11.0
Component: ui.draggable Version: 1.10.3
Keywords: regression Cc:
Blocked by: Blocking:
Description

When draggable is in scrollable div, the widget doesn't follow the mouse.

Tested with safari and chrome browsers.

The bug appears in 1.10.3 version. It is not present in 1.10.2 version !

You can see the bug in this fiddle : http://jsfiddle.net/VPqBp/1/

Attachments (0)
Change History (12)

Changed June 18, 2013 02:15AM UTC by tj.vantoll comment:1

keywords: → regression
status: newopen
summary: Draggable position bug in scrollable divDraggable: position bug in scrollable div

This was almost certainly caused by https://github.com/jquery/jquery-ui/commit/a88d64514001867b908776e6bfcfac7f1011970d and is a duplicate of #9315. But I'll leave this open separately since this is a bit different.

Changed August 31, 2013 01:58PM UTC by tj.vantoll comment:2

Reduced version of test case from tkhyn in #9315: http://jsfiddle.net/tj_vantoll/c4CDc/

This is not a duplicate as #9315 has been fixed.

Changed August 31, 2013 09:22PM UTC by tkhyn comment:3

Thanks tj.vantoll, that's indeed the same issue.

For the record and if it can help the future owner of the ticket, here is my comment and a temporary hack as posted on #9315.

The workaround I found is to replace

>

 if (!this.offset.scroll) { 

>

by
 if (!this.offset.scroll || scroll.scrollTop() != this.offset.scroll.top || scroll.scrollLeft() != this.offset.scroll.left) { 
in the implementations of _convertPositionTo and _generatePosition in jquery.ui.draggable.js. The execution is probably even faster if the condition is removed so that
 this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()}; 
is always executed.

>

Indeed, this.offset.scroll is never updated when the page/container is scrolled (it is only set once when dragging starts and this.offset.scroll is false). In version 1.10.2, the returned values are calculated using scroll.scrollTop() and scroll.scrollLeft() in the return statement instead of using the (fixed) values from this.offset.scroll as it is in version 1.10.3.

Changed September 01, 2013 08:42PM UTC by mikesherov comment:4

milestone: none1.11.0
owner: → mikesherov
priority: minormajor
status: openassigned

Ugh. Ok, I'll fix this soon as well. I suppose when unraveling spaghetti, you're bound to get some sauce on your shirt.

Changed October 16, 2013 01:01AM UTC by glebonator comment:5

Is this the cause of the issue seen here? http://jsfiddle.net/mefa/zrNNZ/15/

Draggable elements jump in FF with anything past 1.8.3

Draggable elements jump in Chrome with 1.8.3

Dragging doesn't work :-\\

Changed October 16, 2013 01:30AM UTC by tj.vantoll comment:6

Replying to [comment:5 glebonator]:

Is this the cause of the issue seen here? http://jsfiddle.net/mefa/zrNNZ/15/ Draggable elements jump in FF with anything past 1.8.3 Draggable elements jump in Chrome with 1.8.3 Dragging doesn't work :-\\

That's #9315, which has already been fixed in master.

Changed October 16, 2013 01:44AM UTC by glebonator comment:7

Thanks, copying in both _convertPositionTo() and _generatePosition() from main has fixed my issue.

Replying to [comment:6 tj.vantoll]:

Replying to [comment:5 glebonator]: > Is this the cause of the issue seen here? http://jsfiddle.net/mefa/zrNNZ/15/ > > Draggable elements jump in FF with anything past 1.8.3 > Draggable elements jump in Chrome with 1.8.3 > > Dragging doesn't work :-\\ That's #9315, which has already been fixed in master.

Changed October 23, 2013 06:05PM UTC by scottgonzalez comment:8

#9617 is a duplicate of this ticket.

Changed November 21, 2013 06:31PM UTC by mattdeclaire comment:9

Changed December 03, 2013 03:09PM UTC by Mike Sherov comment:10

resolution: → fixed
status: assignedclosed

Draggable: normalize lookups for rootNodes when to bust scroll cache. Fixes #9379 - Draggable: position bug in scrollable div

Core: update scrollParent() to support all current supported browsers.

Changeset: 44b2180782df6ef3324789324fcf3f98b85784a0

Changed December 03, 2013 03:10PM UTC by mikesherov comment:11

milestone: 1.11.01.10.4

Changed December 03, 2013 03:55PM UTC by scottgonzalez comment:12

milestone: 1.10.41.11.0

@mikesherov This isn't going to cherry-pick cleanly into 1-10-stable. You can try to resolve the conflicts, but there were some big changes in draggable that didn't get cherry-picked, so pretty much everything results in a conflict.