The best way to control Claude Code, Codex and more from any computer or phone
fix(desktop): annotating inside a page's dialog no longer closes it (#29287)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Noah Jadallah committed
Nov 9, 2026 at 15:31 UTC
e26decde28b73193af30bbea6b12c6add756d81f
1 file changed
+23
apps/desktop/src/preview/PickPreload.ts
+23
@@ -49,6 +49,16 @@ const MAX_MARQUEE_ELEMENTS = 20;
49
const ELEMENT_CONTEXT_TIMEOUT_MS = 5_000;
50
const CONTENT_LAYER_Z_INDEX = 1;
51
const CHROME_LAYER_Z_INDEX = 10;
52
+// Page dialogs (Radix, react-remove-scroll) dismiss, refocus or block scrolling on document events
53
+// that shadow retargeting attributes to the overlay host.
54
+const PAGE_ISOLATED_EVENTS = [
55
+ "pointerdown",
56
+ "focusin",
57
+ "focusout",
58
+ "wheel",
59
+ "touchstart",
60
+ "touchmove",
61
+] as const;
62
63
let recordingCursor: ReturnType<typeof installRecordingCursor> | null = null;
64
ipcRenderer.on(
@@ -1549,6 +1559,13 @@ function startAnnotation(
1559
event.stopPropagation();
1560
};
1561
1562
+ const stopAtOverlay = (event: Event): void => event.stopPropagation();
1563
+ // Focus moving from the page into the overlay targets the page element, so the host never sees it.
1564
+ const onFocusOutToOverlay = (event: FocusEvent): void => {
1565
+ if (event.relatedTarget instanceof Element && isAnnotationNode(event.relatedTarget))
1566
+ event.stopPropagation();
1567
+ };
1568
+
1569
const onPointerOut = (event: PointerEvent): void => {
1570
if (event.relatedTarget === null) clearHoverOutline();
1571
};
@@ -1592,6 +1609,8 @@ function startAnnotation(
1609
dragHandle.removeEventListener("pointermove", onEditorPointerMove);
1610
dragHandle.removeEventListener("pointerup", onEditorPointerUp);
1611
dragHandle.removeEventListener("pointercancel", onEditorPointerUp);
1612
+ for (const type of PAGE_ISOLATED_EVENTS) host.removeEventListener(type, stopAtOverlay);
1613
+ document.documentElement.removeEventListener("focusout", onFocusOutToOverlay);
1614
if (editorLayoutFrame !== null) window.cancelAnimationFrame(editorLayoutFrame);
1615
ipcRenderer.off(CANCEL_PICK_CHANNEL, onCancel);
1616
ipcRenderer.off(ANNOTATION_CAPTURED_CHANNEL, onCaptured);
@@ -1743,6 +1762,10 @@ function startAnnotation(
1762
window.addEventListener("keyup", onVoiceKeyUp, { capture: true });
1763
window.addEventListener("scroll", repaint, { capture: true, passive: true });
1764
window.addEventListener("resize", repaint, { passive: true });
1765
+ // Bubble phase, so the overlay's own handlers still see these events.
1766
+ for (const type of PAGE_ISOLATED_EVENTS)
1767
+ host.addEventListener(type, stopAtOverlay, { passive: true });
1768
+ document.documentElement.addEventListener("focusout", onFocusOutToOverlay);
1769
ipcRenderer.on(CANCEL_PICK_CHANNEL, onCancel);
1770
ipcRenderer.on(ANNOTATION_CAPTURED_CHANNEL, onCaptured);
1771
if (voice) ipcRenderer.on(ANNOTATION_VOICE_STATE_CHANNEL, onVoiceState);