Skip to content

Commit 19d7523

Browse files
committed
fix: treat ctrl+click as right-click on macOS
On macOS, ctrl+click opens the context menu (equivalent to right-click). This change prevents drag from starting when ctrl is held during click, matching the expected behavior. Closes #498
1 parent 1d1ba06 commit 19d7523

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/DraggableCore.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ export default class DraggableCore extends React.Component<DraggableCoreProps> {
291291
// Make it possible to attach event handlers on top of this one.
292292
this.props.onMouseDown(e);
293293

294-
// Only accept left-clicks.
295-
if (!this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false;
294+
// Only accept left-clicks. On macOS, ctrl+click is equivalent to right-click.
295+
if (!this.props.allowAnyClick && ((typeof e.button === 'number' && e.button !== 0) || e.ctrlKey)) return false;
296296

297297
// Get nodes. Be sure to grab relative document (could be iframed)
298298
const thisNode = this.findDOMNode();

0 commit comments

Comments
 (0)