Skip to content
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

not able to multi-select items across lists #2087

Closed
guanxun14 opened this issue Oct 7, 2021 · 2 comments
Closed

not able to multi-select items across lists #2087

guanxun14 opened this issue Oct 7, 2021 · 2 comments

Comments

@guanxun14
Copy link

guanxun14 commented Oct 7, 2021

Custom

Reproduction
codesandbox: https://codesandbox.io/s/eager-boyd-cz63v

as the subject states, I find I'm unable to select multiple items across different sortable lists. To replicate, follow these steps (using given code sandbox above):

  1. hold down the cmd key (on win, you can change it to ctrl if preferred)
  2. use a mouse or pointer to select "one" and "two". both should turn yellow
  3. still holding down cmd, use the mouse to select "five".
  4. see that "one" and "two" were deselected as a result.

What I expected: "five" should be selected along with "one" and "two" retaining their selections.

Digging into the code in sortable.js, I find that I can make this work by commenting out

I'm wondering if there's a less hack-ish way to do this? edit to add: Workaround code that lives outside of modifying the Sortable.js file itself would also be gladly welcome.

Also unsure if commenting out those two lines has undesired side effects, although I've not observed any obvious ones so far (so far being a really short duration).

Thanks!

Related discussion in #1612

@owen-m1
Copy link
Member

owen-m1 commented Oct 11, 2021

@guanxun14 I've never thought of that, nor have I tried it, but if you don't observe any side effects then its probably fine :)
There is no right way to do it, if you found a way to make the library work for you then you are doing it right.
As for not modifying Sortable code, you could probably remove the event listener by calling document.removeEventListener('mouseup', sortableInstance._deselectMultiDrag) after initializing a Sortable instance.

@guanxun14
Copy link
Author

that's super helpful. thank you for the reply and your work on the lib! :)

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