Open
Description
- When a sortable item selection is done programmatically using
Sortable.utils.select()
andSortable.utils.deselect()
, implicit deselection due to an outside click event does not occur if an item is not selected without these utilities beforehand. - Additionally, an utility-based selection also removes any prior hand-made selection.
- These utilities also do not make use of the dispatchEvent function employed by onSelect and onDeselect.
These issues are reproducible in this Codepen.
Implicit deselection
- Click on 'Select first 2' or 'Select All' before any other event
- Click outside any of the sortable items
- Observed behavior: Selection is unchanged
- Expected behavior: Selection is fully deselected/removed
The proper behavior can be restored by vanilla selecting an item:
- Click on a sortable item to select it
- Click on 'Select first 2' or 'Select All' to create an util-based selection
- Click outside any of the sortable items
- Observed behavior: Selection is fully deselected/removed, as expected
Util selection override
- Click on sortable 'D', for instance
- Click on 'Select first 2'
- Observed behavior: Util-based selection overrides initial selection
- Expected behavior: Util-based selection should complement initial selection such that selected items encompass 'A', 'B', 'D'
Versions
sortablejs = ^1.15.0
@types/sortablejs = ^1.13.0
Note The Codepen example linked above uses the complete Sortable source from #2181 but the described behavior is unchanged from ^1.15.0.
Metadata
Metadata
Assignees
Labels
No labels