SortableJS/Sortable

[bug] onEnd indexes are incorrect when using `draggable`

jamesst20 opened this issue · 1 comments

Versions

SortableJS 1.15.2

Reproduction

CodeSandbox

Why this is happening

It seems SortableJS internally doesn't care for the draggable class when it counts children so the <thead> count for one element always while not being draggable at all.

An ugly workaround is to offset by -1 in my function but this is most likely a bug.

Workaround is to use the proper index:

		evt.oldDraggableIndex; // element's old index within old parent, only counting draggable elements
		evt.newDraggableIndex; // element's new index within new parent, only counting draggable elements