clauderic / react-sortable-hoc

A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable list✌️
https://clauderic.github.io/react-sortable-hoc/
MIT License
10.77k stars 978 forks source link

fix: disabling start for middle mouse button #852

Open cgood92 opened 2 years ago

cgood92 commented 2 years ago

Fix: disabling start for middle mouse button

There are 5 possible values for event.button:

0: Main button pressed, usually the left button or the un-initialized state 1: Auxiliary button pressed, usually the wheel button or the middle button (if present) 2: Secondary button pressed, usually the right button 3: Fourth button, typically the Browser Back button 4: Fifth button, typically the Browser Forward button

(Source: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button)

We should not start dragging if either middle or right mouse buttons are clicked

I did not see any unit tests, please let me know if I missed that, as I would be happy to add a unit test.

codesandbox-ci[bot] commented 2 years ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5b31ad44c696592cd0b0a05516e54051596fb116:

Sandbox Source
react-sortable-hoc-starter Configuration