ValentinH / react-easy-sort

A React component to sort items in lists or grids
https://ValentinH.github.io/react-easy-sort
MIT License
160 stars 25 forks source link

On non-touch device, the Drag Gesture is too sensitive #7

Closed kfkkail closed 3 years ago

kfkkail commented 3 years ago

Describe the bug On a non-touch device, the 1 pixel that is used to start the drag gesture is too sensitive when the SortableItem has other elements to interact with. Buttons / Inputs, etc.

To Reproduce Steps to reproduce the behavior:

  1. Add a button and/or form inside the SortableItem (see codesandbox below)
  2. Click on the button and use the input box
  3. Varying clicks will trigger the drag gesture when interacting with the button/form when the user does not mean to drag

Expected behavior When interacting with the elements, a drag gesture should not be triggered. Maybe adding the ability to decrease the sensitivity on non-touch devices would help with this scenario.

https://codesandbox.io/s/bold-resonance-5ke7q?file=/src/App.tsx

ValentinH commented 3 years ago

Hi 👋 I'm not on my computer right now and will not have access to it in the coming days but: did you try to call e.stopPropagation() on the onMouseDown handler of the button?

kfkkail commented 3 years ago

That looks to help. Thanks for the suggestion.