Opened 5 years ago
Last modified 5 years ago
#15273 new bug
Using a draggable with a connected sortable causes error if sort returns false
Reported by: | pvbergen | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.draggable | Version: | 1.12.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
Using a draggable with a connected sortable causes an "Uncaught TypeError: Cannot read property '0' of null" when sortable.sort returns false. I guess that the sortable destroys the dragged element and draggable wants to access it afterwards.
Example
$(".sortable").sortable({ sort: function(e, t) { return false; } }); $(".draggable").draggable({ connectToSortable: ".sortable", });
Codepen
https://codepen.io/anon/pen/XZELqm
Current workaround
- Return true in sort and handle cancellation in stop callback.
- Use $(t.item).trigger('mouseup'); in draggable.drag to stop drag.
Background
I want to implement cancelling of a drag operation into a sortable. Sort returning false cancels the operation on mousemove instead of waiting for mouseup and stop.
Note: See
TracTickets for help on using
tickets.
Completed workaround