Skip to content

[bug] utils.select buggy behavior #2189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tomasmenezes opened this issue Aug 19, 2022 · 1 comment
Open

[bug] utils.select buggy behavior #2189

tomasmenezes opened this issue Aug 19, 2022 · 1 comment

Comments

@tomasmenezes
Copy link

  • When a sortable item selection is done programmatically using Sortable.utils.select() and Sortable.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

  1. Click on 'Select first 2' or 'Select All' before any other event
  2. 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:

  1. Click on a sortable item to select it
  2. Click on 'Select first 2' or 'Select All' to create an util-based selection
  3. Click outside any of the sortable items
  • Observed behavior: Selection is fully deselected/removed, as expected

Util selection override

  1. Click on sortable 'D', for instance
  2. 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.

@ashauryn
Copy link

No solution to this yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants