From 19d7523605b60d6ac495d6fd43d4bd73fa3cb02b Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Tue, 30 Dec 2025 22:41:00 -0500 Subject: [PATCH] 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 --- lib/DraggableCore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/DraggableCore.js b/lib/DraggableCore.js index f9d67d0a..505be625 100644 --- a/lib/DraggableCore.js +++ b/lib/DraggableCore.js @@ -291,8 +291,8 @@ export default class DraggableCore extends React.Component { // Make it possible to attach event handlers on top of this one. this.props.onMouseDown(e); - // Only accept left-clicks. - if (!this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false; + // Only accept left-clicks. On macOS, ctrl+click is equivalent to right-click. + if (!this.props.allowAnyClick && ((typeof e.button === 'number' && e.button !== 0) || e.ctrlKey)) return false; // Get nodes. Be sure to grab relative document (could be iframed) const thisNode = this.findDOMNode();