From 3e7b57282e1a0c45bb54119d1fb5d40acd349818 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 25 Feb 2026 18:22:25 +0800 Subject: [PATCH] fix: delay context menu to prevent broken input loop on macOS, closes #3324 (#3378) When a native context menu is triggered via right-click, the menu.popup() call immediately takes control and disrupts the browser's pointer event flow. This prevents the pointerUp event from being delivered, leaving the input event loop in an inconsistent state where the first tap after dismissing the menu is not captured. The fix adds a 100ms delay before showing the context menu, allowing the browser's input loop to complete the pointerUp event for the right-click before the native menu interferes. --- apps/readest-app/src/hooks/useLongPress.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/readest-app/src/hooks/useLongPress.ts b/apps/readest-app/src/hooks/useLongPress.ts index 7f9aaeef..dd11d863 100644 --- a/apps/readest-app/src/hooks/useLongPress.ts +++ b/apps/readest-app/src/hooks/useLongPress.ts @@ -140,7 +140,9 @@ export const useLongPress = ( if (onContextMenu) { e.preventDefault(); e.stopPropagation(); - onContextMenu(); + setTimeout(() => { + onContextMenu(); + }, 100); } reset(); },