Opened 7 years ago

Closed 6 years ago

#5811 closed bug (fixed)

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 (5)

comment:2 Changed 7 years ago by Skaffen

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).

comment:3 Changed 7 years ago by Skaffen

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).

comment:4 Changed 6 years ago by Scott González

Milestone: TBD1.8.11
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.