Skip to content

Commit 5b31ad4

Browse files
authored
fix: disabling start for middle mouse button
There are 3 possible values for `event.button`: - 0: left mouse button - 1: middle mouse button - 2: right mouse button We should not start dragging if either middle or right mouse buttons are clicked
1 parent caf3c4f commit 5b31ad4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/SortableContainer/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import {
3636
defaultKeyCodes,
3737
} from './props';
3838

39+
const LEFT_MOUSE_BUTTON = 0;
40+
3941
export const SortableContext = React.createContext({
4042
manager: {},
4143
});
@@ -124,7 +126,7 @@ export default function sortableContainer(
124126
handleStart = (event) => {
125127
const {distance, shouldCancelStart} = this.props;
126128

127-
if (event.button === 2 || shouldCancelStart(event)) {
129+
if (event.button !== LEFT_MOUSE_BUTTON || shouldCancelStart(event)) {
128130
return;
129131
}
130132

0 commit comments

Comments
 (0)