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

Adding a min size for select box before it starts selecting items #85

Open
cathykc opened this issue May 9, 2020 · 5 comments
Open

Comments

@cathykc
Copy link

cathykc commented May 9, 2020

First of all - thank you for open sourcing this component! It's saving me a lot of time since I don't need to build this entirely from scratch.


Thoughts on adding an option to set a min size for the select box before it triggers the duringSelection?

When people click their mouse it's highly likely that while the mouse is down they move their mouse slightly. This means a drag event is triggered and that the item gets selected so the original click event (e.g. open a modal) doesn't actually happen. This can be confusing to users as they think they just did a mouse click.

Happy to submit a PR but want to make sure that you think this would be a good edit :) Happy to chat more.

@Samin100
Copy link

Samin100 commented Dec 30, 2020

This is a great recommendation! A quick hotfix I've found to work well at allowing normal click events to still happen is to swap the event.preventDefault() from being called in the mousedown event handler, and instead call it in mousemove event handler. I'm wondering why this isn't the default behavior, as it makes mouse clicks on a draggable element far more reliable at preventing unintended drag starts.

@heri16
Copy link

heri16 commented Jan 29, 2021

This is a great recommendation! A quick hotfix I've found to work well at allowing normal click events to still happen is to swap the event.preventDefault() from being called in the mousedown event handler, and instead call it in mousemove event handler. I'm wondering why this isn't the default behavior, as it makes mouse clicks on a draggable element far more reliable at preventing unintended drag starts.

Not sure what is meant by this. Maybe post permalinks to the lines involved?

@ludwighen
Copy link

totally agree. I was having the same problem. @Samin100 could you explain your solution?

@PaulRyan97
Copy link

Also having the same problem, any update on this?

@ludwighen
Copy link

ludwighen commented Mar 23, 2021

I made a PR with this changes #101
But as pointed out, this repo might not be regularly maintained, so if you want to use my fork with the fix:

npm install github:ludwighen/react-selectable-fast

it adds a minSelectSize prop to the SelectableGroup where you can specify pixels distance moved before the selection starts.
I found 8 or 10 to be a good value.

<SelectableGroup minSelectSize={8}>

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

5 participants