From 554388b28d25c020342c1f97a016392d0fa35f71 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 30 May 2026 11:32:56 -0700 Subject: [PATCH] fix: cancel mobile browser long press from root ref --- mobile/src/browser/MobileBrowserPane.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mobile/src/browser/MobileBrowserPane.tsx b/mobile/src/browser/MobileBrowserPane.tsx index b53ef24d6..b3387297a 100644 --- a/mobile/src/browser/MobileBrowserPane.tsx +++ b/mobile/src/browser/MobileBrowserPane.tsx @@ -188,6 +188,17 @@ export function MobileBrowserPane({ } }, []) + const setRootViewRef = useCallback( + (node: View | null) => { + // Why: long-press right-click timers belong to this responder surface; + // clearing from ref cleanup preserves the same unmount boundary. + if (node === null) { + clearLongPressTimer() + } + }, + [clearLongPressTimer] + ) + const resetBrowserZoomState = useCallback(() => { clearLongPressTimer() pinchRef.current = null @@ -694,8 +705,6 @@ export function MobileBrowserPane({ [client, flushPendingWheelCommand, pageParams] ) - useEffect(() => () => clearLongPressTimer(), [clearLongPressTimer]) - const mapTouchPoint = useCallback((locationX: number, locationY: number): BrowserPoint | null => { return mapScreenToBrowserPoint( locationX, @@ -1017,7 +1026,7 @@ export function MobileBrowserPane({ ) return ( - +