From 4f9c179dd36c9778c28bfb37f80bd939057e96a0 Mon Sep 17 00:00:00 2001 From: okxint Date: Wed, 6 May 2026 16:42:09 +0530 Subject: [PATCH] fix: handle Mac trackpad tap-to-click in isSingleLeftClick (#7736) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mac trackpad tap-to-click fires mousedown with {button:0, buttons:0}. Consolidate the mouseup and mousedown {0,0} checks into a single `event.type !== 'mousemove'` guard — the only event type where {0,0} should be rejected is mousemove, which signals button release during a drag. Closes #7736 --- src/js/utils/dom.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/js/utils/dom.js b/src/js/utils/dom.js index 0505850064..a2d4a9961c 100644 --- a/src/js/utils/dom.js +++ b/src/js/utils/dom.js @@ -775,18 +775,15 @@ export function isSingleLeftClick(event) { return true; } - // `mouseup` event on a single left click has - // `button` and `buttons` equal to 0 - if (event.type === 'mouseup' && event.button === 0 && + // `button` and `buttons` are both 0 on `mouseup` (release) and on + // `mousedown` when a Mac trackpad tap-to-click fires {button:0, buttons:0}. + // The only event type where {0,0} should be rejected is `mousemove`, + // because it signals that the button was released during a drag. + if (event.type !== 'mousemove' && event.button === 0 && event.buttons === 0) { return true; } - // MacOS Sonoma trackpad when "tap to click enabled" - if (event.type === 'mousedown' && event.button === 0 && event.buttons === 0) { - return true; - } - if (event.button !== 0 || event.buttons !== 1) { // This is the reason we have those if else block above // if any special case we can catch and let it slide