Ticket #5811 (closed bug: fixed)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

Description

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.

Change History

comment:2 Changed 4 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 4 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 3 years ago by scott.gonzalez

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from TBD to 1.8.11
Note: See TracTickets for help on using tickets.