SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.77k stars 3.71k forks source link

Why two actions click outsite drag drop area and use jquery trigger click element outside are different? #2259

Closed namnguyen2091 closed 1 year ago

namnguyen2091 commented 1 year ago

Custom Case 1: I use my mouse to click one area outside of drag and drop, and I see "sortable-selected" class in items are removed.
Case 2: Like case 1 but I use jquery to click to element A but "sortable-selected" can not be removed. In this case I want to do the same result as case 1. Why??? and how to do case 2 like case 1.

owen-m1 commented 1 year ago

The click has to bubble to the document object for it to deselect, but you can use Sortable.utils.deselect to deselect any or all of the selected elements whenever you want https://github.com/SortableJS/Sortable/tree/master/plugins/MultiDrag#sortableutils