Sortable icon indicating copy to clipboard operation
Sortable copied to clipboard

Bug: sort method doesn't work if there are other children in the sortable parent

Open pr3tori4n opened this issue 5 years ago • 8 comments

Problem:

If you create a sortable on a container, and use the draggable selector to identify the sortable elements, but there are other non-sortable sibling elements in that container, the sort method fails. An example would be if a header was the first child of the sortable container.

The problem is this line. This is getting the child at the index of the loop, but it's considering all child elements. It needs to first sort out those that don't match the draggable selector. https://github.com/SortableJS/Sortable/blob/master/src/Sortable.js#L1571

JSBin/JSFiddle demonstrating the problem:

https://jsfiddle.net/pr3tori4n/k17dhqo8/

pr3tori4n avatar Nov 19 '19 19:11 pr3tori4n