Skip to main content

Search and Top Navigation

#5811 closed bug (fixed)

Opened July 08, 2010 10:46PM UTC

Closed March 14, 2011 02:56PM UTC

Draggable li with connectToSortable option cannot be dropped on the connected sortable ol

Reported by: nathansobo Owned by:
Priority: major Milestone: 1.8.11
Component: ui.draggable Version: 1.8.2
Keywords: draggable, sortable, connectToSortable Cc:
Blocked by: Blocking:

I have one ol with a bunch of draggable li's. These are connected to another sortable ol. When I drag an li over to the sortable list it is always reverted. With the one line change in the given patch it works properly.

Attachments (1)
Change History (4)

Changed November 01, 2010 01:21PM UTC by Skaffen comment:2

I've also hit this bug, and before reading this bug report and suggested fix I'd come to the same conclusion about the fix that was needed.

To give a bit more comment on the cause of this bug and why the fix works - the connectToSortable code uses the sortable's containerCache position information to calculate when the draggable has been dragged over the sortable. The sortable code itself updates this cache on mouseStart (since changes on the page since the last time containerCache was updated could mean it was out of date if the container has moved), but since moving the draggable doesn't trigger this mouseStart code it needs to trigger the containerCache being refresh itself.

It looks like _refreshItems used to be the call that did this, however at some point the code to update the containerCache was split off into refreshPositions (and mouseStart calls that) but unfortunately no-one spotted that connectToSortable needed to be changed to call refreshPositions now.

If a test case were needed I would think it would need to be a page which initialises a sortable, connects a draggable to it and then inserts an element into the page to move the sortable's location (thus meaning that containerCache is out of date).

Changed November 01, 2010 01:24PM UTC by Skaffen comment:3

PS - the title of this bug should be changed as it's misleading - the bug is that connectToSortable misbehaves if the position of the sortable changes after the sortable and draggable have been initialised (and if not sortable elements are dragged first, as that would trigger a containerCache update too I believe, and thus mask the problem).

Changed March 14, 2011 02:56PM UTC by scottgonzalez comment:4

milestone: TBD1.8.11
resolution: → fixed
status: newclosed

Fixed in 84257e7f0ae20b81b085f1360c15defdd2b89ea9.