Repository navigation
fix(browser): annotation card and outline follow the picked element - #27875
Conversation
The grab overlay keeps re-measuring the picked element after the click (scroll in any box, resize, element size changes), and the isolated viewport bridge reports that live box so the pending card follows it, including page zoom. The card's side pick uses its measured height.
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to The maintenance workflow can corrupt a missing baseline; fix this small issue before or shortly after merging. Pre-merge checks ·
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4d8b93b9-c81c-423c-8e0c-f457e03cbb9a
📒 Files selected for processing (12)
src/main/browser/grab-guest-overlay-follow.test.tssrc/main/browser/grab-guest-overlay-script.tssrc/main/browser/grab-guest-script.test.tssrc/renderer/src/components/browser-pane/annotate/browser-guest-annotate-overlays.tsxsrc/renderer/src/components/browser-pane/annotate/pending-browser-annotation-card.tsxsrc/renderer/src/components/browser-pane/annotate/use-browser-page-grab-annotations.tssrc/renderer/src/components/browser-pane/describe-page/browser-annotation-geometry.test.tssrc/renderer/src/components/browser-pane/describe-page/browser-annotation-geometry.tssrc/renderer/src/components/browser-pane/host-guest/browser-page-webview-navigation-handlers.tssrc/shared/browser-annotation-viewport-bridge.tssrc/shared/browser-annotation-viewport-live-target.test.tssrc/shared/browser-annotation-viewport-report.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| const trackTarget = (state) => { | ||
| const current = state.target; | ||
| const next = !emitViewportMessages | ||
| ? null | ||
| : current && current.isConnected && current.hasAttribute(selectedAttribute) | ||
| ? current | ||
| : document.querySelector('[' + selectedAttribute + ']'); | ||
| if (next !== current) { | ||
| state.target = next; | ||
| if (state.targetObserver) { | ||
| state.targetObserver.disconnect(); | ||
| if (next) { | ||
| state.targetObserver.observe(next); | ||
| state.targetObserver.observe(document.documentElement); | ||
| } | ||
| } | ||
| } | ||
| return next; | ||
| }; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '95,170p' src/shared/browser-annotation-viewport-bridge.ts
sed -n '245,290p' src/shared/browser-annotation-viewport-bridge.ts
sed -n '1,130p' src/renderer/src/components/browser-pane/annotate/guest-annotation-viewport-bridge.ts
sed -n '145,185p' src/renderer/src/components/browser-pane/annotate/use-browser-page-grab-annotations.tsRepository: stablyai/orca
Length of output: 7088
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- bridge declarations and lifecycle ---'
rg -n -F --glob 'src/shared/browser-annotation-viewport-bridge.ts' -e 'const updateMarkers' -e 'const cleanup' -e 'const positionMarkers' -e 'export function' -e 'requestUpdate' -e 'setAnnotationViewportBridge' src/shared/browser-annotation-viewport-bridge.ts
sed -n '1,115p' src/shared/browser-annotation-viewport-bridge.ts
sed -n '115,285p' src/shared/browser-annotation-viewport-bridge.ts
printf '%s\n' '--- renderer hook and callers ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'syncGuestAnnotationViewportBridge' -e 'setBrowserOverlayViewport' -e 'pendingAnnotationPayload' -e 'BROWSER_GRAB_SELECTED_ATTRIBUTE' src/renderer/src src/shared
sed -n '1,240p' src/renderer/src/components/browser-pane/annotate/use-browser-page-grab-annotations.ts
sed -n '1,180p' src/renderer/src/components/browser-pane/annotate/guest-annotation-viewport-bridge.tsRepository: stablyai/orca
Length of output: 36349
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- selected marker lifecycle ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'data-orca-grab-selected' -e 'BROWSER_GRAB_SELECTED_ATTRIBUTE' -e 'selectedAttribute' src
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'setAnnotationViewportBridge({' -e 'syncGuestAnnotationViewportBridge({' src/renderer/src/components/browser-pane
sed -n '1,260p' src/renderer/src/components/browser-pane/annotate/browser-guest-annotate-overlays.tsx
printf '%s\n' '--- webview lifecycle bridge synchronization ---'
sed -n '180,245p' src/renderer/src/components/browser-pane/host-guest/use-browser-page-webview-lifecycle.ts
sed -n '1,125p' src/renderer/src/components/browser-pane/annotate/guest-annotation-viewport-bridge.test.ts
printf '%s\n' '--- grab overlay implementation candidates ---'
rg --files src | rg 'grab.*overlay|overlay.*grab|guest.*grab'Repository: stablyai/orca
Length of output: 19064
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- grab overlay complete lifecycle ---'
sed -n '1,190p' src/main/browser/grab-guest-overlay-script.ts
printf '%s\n' '--- bridge IPC binding and execution ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'setAnnotationViewportBridge' -e 'buildBrowserAnnotationViewportBridgeScript' src/main src/renderer src/shared
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'browserPageId' -e 'annotation viewport bridge' src/main/browser | head -80
printf '%s\n' '--- live target test scenarios ---'
sed -n '1,210p' src/shared/browser-annotation-viewport-live-target.test.ts
printf '%s\n' '--- grab follow tests ---'
sed -n '1,180p' src/main/browser/grab-guest-overlay-follow.test.tsRepository: stablyai/orca
Length of output: 34833
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- grab controller and manager ordering ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'freezeHighlight' -e 'cleanup()' -e 'GRAB_GUEST_OVERLAY_SCRIPT' -e 'buildGuestOverlayScript' -e 'stopTrackingSelection' -e 'grabGuest' src/main src/renderer
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'awaitClick' -e 'finalize' -e 'rearm' -e 'toggle' src/main/browser src/renderer/src/components/browser-pane/annotate | head -160
printf '%s\n' '--- viewport bridge execution ---'
sed -n '1,165p' src/main/browser/browser-manager-viewport.ts
sed -n '80,150p' src/main/ipc/browser-guest-view-ipc.ts
printf '%s\n' '--- grab script entrypoint ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'grab-guest-overlay-script' -e 'grab-guest-script' src/main src/rendererRepository: stablyai/orca
Length of output: 41605
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- report consumer ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'applyBrowserAnnotationViewportReport' -e 'parseBrowserAnnotationViewportReport' -e 'BROWSER_ANNOTATION_VIEWPORT_MESSAGE_PREFIX' src/renderer/src src/main
sed -n '150,220p' src/main/browser/browser-manager-grab-selection-scripts.ts 2>/dev/null || true
sed -n '1,150p' src/main/browser/grab-guest-selection-scripts.ts
printf '%s\n' '--- selection controller ordering ---'
sed -n '45,155p' src/main/browser/browser-grab-session-controller.ts
sed -n '1,145p' src/main/browser/browser-manager-grab.ts
printf '%s\n' '--- bridge sync effect ---'
sed -n '195,235p' src/renderer/src/components/browser-pane/host-guest/use-browser-page-webview-lifecycle.tsRepository: stablyai/orca
Length of output: 18568
🏁 Script executed:
set -o pipefail
sed -n '175,210p' src/renderer/src/components/browser-pane/describe-page/browser-annotation-geometry.ts
sed -n '180,210p' src/renderer/src/components/browser-pane/host-guest/browser-page-webview-navigation-handlers.ts
sed -n '285,325p' src/renderer/src/components/browser-pane/host-guest/use-browser-page-webview-lifecycle.ts
sed -n '1,80p' src/renderer/src/components/browser-pane/annotate/use-browser-page-annotation-viewport-tracking.tsRepository: stablyai/orca
Length of output: 4591
🏁 Script executed:
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'annotationViewportBridgeTokenRef' -e 'annotationViewportBridgeToken' -e 'createAnnotationViewportBridge' src/renderer/src/components/browser-paneRepository: stablyai/orca
Length of output: 2467
Invalidate viewport reports when a new grab starts.
A report from the previous selection can be emitted before its marker is removed and delivered after the renderer clears browserOverlayViewport.target. The current per-webview token remains valid, so the handler applies the old report.target before the newly scheduled report arrives. Rotate the existing bridge token on each pending-payload transition before syncing the bridge. This rejects delayed reports from the previous selection.
Suggested fix
const annotationViewportBridgeTokenRef = useRef<string>(undefined!)
annotationViewportBridgeTokenRef.current ??= createBrowserUuid().replaceAll('-', '')
+ const previousPendingAnnotationPayloadRef = useRef(pendingAnnotationPayload)
+ useLayoutEffect(() => {
+ if (previousPendingAnnotationPayloadRef.current === pendingAnnotationPayload) {
+ return
+ }
+ previousPendingAnnotationPayloadRef.current = pendingAnnotationPayload
+ annotationViewportBridgeTokenRef.current = createBrowserUuid().replaceAll('-', '')
+ }, [pendingAnnotationPayload])…ary (#28054) #27756's script imported baseline helpers from check-focus-read-ratchet.mjs after #27788 had moved them into ratchet-baseline.mjs, so it crashed on start and failed every PR that merges main. Use the library's helpers, and record the two daemon-process launches from #27769 that the broken check never saw. Co-authored-by: Orca Worker <orca-worker@localhost>
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c3383483-15f0-4b87-aec8-6deca7db45df
📒 Files selected for processing (20)
config/main-sync-spawn-baseline.txtconfig/scripts/check-main-sync-spawn-ratchet.mjssrc/main/browser/grab-guest-overlay-follow.test.tssrc/main/browser/grab-guest-overlay-script.tssrc/main/browser/grab-guest-script.test.tssrc/main/browser/grab-guest-selection-scripts.tssrc/main/ipc/browser-annotation-viewport-ipc.test.tssrc/main/ipc/browser-guest-view-ipc.tssrc/renderer/src/components/browser-pane/annotate/browser-annotation-viewport-message.tssrc/renderer/src/components/browser-pane/annotate/guest-annotation-viewport-bridge.test.tssrc/renderer/src/components/browser-pane/annotate/guest-annotation-viewport-bridge.tssrc/renderer/src/components/browser-pane/host-guest/browser-page-annotation-document.test.tssrc/renderer/src/components/browser-pane/host-guest/browser-page-webview-navigation-handlers.tssrc/renderer/src/components/browser-pane/workspace-doc/HtmlDocPreview.tsxsrc/renderer/src/components/browser-pane/workspace-doc/doc-preview-webview-attach.test.tssrc/renderer/src/components/browser-pane/workspace-doc/doc-preview-webview-attach.tssrc/renderer/src/components/browser-pane/workspace-doc/use-doc-preview-guest-tools.test.tssrc/renderer/src/components/browser-pane/workspace-doc/use-doc-preview-guest-tools.tssrc/shared/browser-annotation-viewport-bridge.tssrc/shared/browser-annotation-viewport-live-target.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| freezeHighlight: function(selectionId) { | ||
| host.removeEventListener('mousemove', onPointerMove); | ||
| host.style.pointerEvents = 'none'; | ||
| host.style.cursor = 'default'; | ||
| // Why: the outline must follow the element after the click — page and inner-box | ||
| // scroll (capture), resize/zoom and the element's own size changes. | ||
| selectedEl = currentEl; | ||
| if (!selectedEl) return; | ||
| // Why: the isolated-world viewport bridge finds the selection by this marker; it | ||
| // cannot see this world's objects, and the page must not see the bridge's token. | ||
| previousSelectedValue = selectedEl.getAttribute(selectedAttribute); | ||
| selectedValue = selectionId; | ||
| selectedEl.setAttribute(selectedAttribute, selectionId); | ||
| highlightBox.style.transition = 'none'; | ||
| window.addEventListener('scroll', scheduleFrozenHighlight, true); | ||
| window.addEventListener('resize', scheduleFrozenHighlight, true); | ||
| if (typeof ResizeObserver === 'function') { | ||
| frozenResizeObserver = new ResizeObserver(scheduleFrozenHighlight); | ||
| frozenResizeObserver.observe(selectedEl); | ||
| // A scrollbar appearing narrows the page without a window resize. | ||
| frozenResizeObserver.observe(document.documentElement); | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n 'freezeHighlight|stopTrackingSelection|awaitClick|__orcaGrab|cleanup' src/main/browser/grab-guest-overlay-script.ts src/main/browser/grab-guest-selection-scripts.ts src/main/browser/browser-grab-session-controller.ts src/main/browser/browser-manager-grab.ts
sed -n '70,175p' src/main/browser/grab-guest-overlay-script.ts
sed -n '1,120p' src/main/browser/grab-guest-selection-scripts.tsRepository: stablyai/orca
Length of output: 11149
Clear the previous selection before a new freeze.
AWAIT_CLICK_SCRIPT calls freezeHighlight once for either the click or context-menu path, so a single selection does not repeat the call. However, the session controller can preserve the overlay after a selected or context-selected result, and a later awaitClick can run against the same __orcaGrab before cleanup. A second freeze then overwrites the previous selection state without disconnecting the earlier ResizeObserver or restoring the earlier marker.
Call stopTrackingSelection() before assigning the new selection.
Suggested fix
--- "a/src/main/browser/grab-guest-overlay-script.ts"
+++ "b/src/main/browser/grab-guest-overlay-script.ts"
@@ -125,8 +125,9 @@
// the renderer shows the copy menu. Disabling pointer-events on the host
// lets the cursor return to normal and prevents the crosshair from showing
// over the dropdown menu's area in the webview.
freezeHighlight: function(selectionId) {
+ stopTrackingSelection();
host.removeEventListener('mousemove', onPointerMove);
host.style.pointerEvents = 'none';
host.style.cursor = 'default';
// Why: the outline must follow the element after the click — page and inner-box📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| freezeHighlight: function(selectionId) { | |
| host.removeEventListener('mousemove', onPointerMove); | |
| host.style.pointerEvents = 'none'; | |
| host.style.cursor = 'default'; | |
| // Why: the outline must follow the element after the click — page and inner-box | |
| // scroll (capture), resize/zoom and the element's own size changes. | |
| selectedEl = currentEl; | |
| if (!selectedEl) return; | |
| // Why: the isolated-world viewport bridge finds the selection by this marker; it | |
| // cannot see this world's objects, and the page must not see the bridge's token. | |
| previousSelectedValue = selectedEl.getAttribute(selectedAttribute); | |
| selectedValue = selectionId; | |
| selectedEl.setAttribute(selectedAttribute, selectionId); | |
| highlightBox.style.transition = 'none'; | |
| window.addEventListener('scroll', scheduleFrozenHighlight, true); | |
| window.addEventListener('resize', scheduleFrozenHighlight, true); | |
| if (typeof ResizeObserver === 'function') { | |
| frozenResizeObserver = new ResizeObserver(scheduleFrozenHighlight); | |
| frozenResizeObserver.observe(selectedEl); | |
| // A scrollbar appearing narrows the page without a window resize. | |
| frozenResizeObserver.observe(document.documentElement); | |
| } | |
| freezeHighlight: function(selectionId) { | |
| stopTrackingSelection(); | |
| host.removeEventListener('mousemove', onPointerMove); | |
| host.style.pointerEvents = 'none'; | |
| host.style.cursor = 'default'; | |
| // Why: the outline must follow the element after the click — page and inner-box | |
| // scroll (capture), resize/zoom and the element's own size changes. | |
| selectedEl = currentEl; | |
| if (!selectedEl) return; | |
| // Why: the isolated-world viewport bridge finds the selection by this marker; it | |
| // cannot see this world's objects, and the page must not see the bridge's token. | |
| previousSelectedValue = selectedEl.getAttribute(selectedAttribute); | |
| selectedValue = selectionId; | |
| selectedEl.setAttribute(selectedAttribute, selectionId); | |
| highlightBox.style.transition = 'none'; | |
| window.addEventListener('scroll', scheduleFrozenHighlight, true); | |
| window.addEventListener('resize', scheduleFrozenHighlight, true); | |
| if (typeof ResizeObserver === 'function') { | |
| frozenResizeObserver = new ResizeObserver(scheduleFrozenHighlight); | |
| frozenResizeObserver.observe(selectedEl); | |
| // A scrollbar appearing narrows the page without a window resize. | |
| frozenResizeObserver.observe(document.documentElement); | |
| } |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/main/browser/grab-guest-overlay-script.ts (1)
128-129: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winStop the previous selection tracking before a new freeze.
The
freezeHighlightfunction overwritesselectedEl,selectedValue, andfrozenResizeObserverwithout releasing the earlier state. If the overlay is reused andfreezeHighlightruns again, the earlierResizeObserverstays connected. The earlier element keeps its marker attribute. CallstopTrackingSelection()at the start of the function. This is the same concern as the earlier review comment.Proposed fix
freezeHighlight: function(selectionId) { + stopTrackingSelection(); host.removeEventListener('mousemove', onPointerMove);
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0c15b635-a5b3-4dbd-8c2e-dbf8b3f0c28c
📒 Files selected for processing (5)
src/main/browser/grab-guest-overlay-follow.test.tssrc/main/browser/grab-guest-overlay-script.tssrc/main/browser/grab-guest-script.test.tssrc/shared/browser-annotation-viewport-bridge.tssrc/shared/browser-annotation-viewport-live-target.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Reject a missing baseline before pruning. · ratchet-baseline.mjs:162-172
config/scripts/ratchet-baseline.mjs:162-172
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winReject a missing baseline before pruning.
pruneCountBaselinetreats a missing file as empty and writes a header-only baseline. The reachable--pruneworkflow callsprune()and thenmain(), so a missing baseline can be created and the subsequent count check can fail when current counts are nonzero. This violates the contract that pruning requires an existing baseline and that initialization uses--init.Suggested fix
- const text = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : '' + const text = fs.readFileSync(file, 'utf8')
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e5af2b9c-a372-44d4-9f29-0185e12d9126
📒 Files selected for processing (2)
src/shared/agent-session-failure-words.tssrc/shared/agent-session-start-refusal-resumable.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
|
The white selection outline and pending note card could stay at old positions after scrolling, pane resize, zoom, or changes to the selected element’s size. The change retains the selected element, remeasures it on those events, and places the existing card from its current rectangle and measured height. Four review rounds fixed three gaps: page-owned markers could attach the card to the wrong element; HTML previews did not handle live coordinate reports; and the observers watched content size while missing border/padding growth. Selection now uses its capture identity, browser pages and previews share the protected coordinate-report handler, and selected elements are observed with Regressions were demonstrated failing before the fixes. The geometry head passed 172 targeted tests and both Node/renderer TypeScript checks; a fresh reviewer passed 54 tests and found no additional high- or medium-priority issue. The exact upstream CI dependency repair passed 123 relevant tests. Final head Rendered QA remains unqualified. At Pure transform-only movement remains deferred. Preview drafts surviving navigation predate this PR; iframe picking and saved-note re-identification are outside scope. The named readiness-checklist skill was unavailable, so the accepted general final risk audit ran instead. The existing event-driven positioning mechanism remains in place. |
…#28110) HtmlDocPreview.tsx reached 403 lines on main (#27608 + #27875), over the 400-line limit for .tsx, so lint and the pre-commit hook fail on any branch that merges main. The focus handoff effect moves unchanged into use-doc-preview-guest-focus.ts. Co-authored-by: Orca Worker <orca-worker@localhost>
…#28110) HtmlDocPreview.tsx reached 403 lines on main (#27608 + #27875), over the 400-line limit for .tsx, so lint and the pre-commit hook fail on any branch that merges main. The focus handoff effect moves unchanged into use-doc-preview-guest-focus.ts. Co-authored-by: Orca Worker <orca-worker@localhost> (cherry picked from commit 5e83ca0)
ELI5
Review status at
7e1151dd: code fixes and CI checks pass; final rendered qualification remains open. The review validation below records the hidden-frame discrepancy and unverified flows.In the browser pane you can pick an element on a web page and write a note about it. A note card opens beside the element and a white outline marks it. Until now Orca measured the element only once, at the click. If you then scrolled, resized or zoomed, the white outline stayed where the element used to be, and the card stayed anchored to that old spot too. Now both keep following the element.
What Changed
What you saw before (still true on
mainafter #26596):freezeHighlight()), and the app placed the card from the click-time position minus the window's scroll. Scrolling inside a box doesn't change the window's scroll, and resize/zoom/layout changes were never seen.What you see now: the outline and the card move together with the element on page scroll, scrolling inside a box, window/pane resize, page zoom and size changes of the element itself.
How:
ResizeObserver), batched to one update per animation frame, and redraws the outline from that.Why
This is the common pattern for an element picker: whatever can see the element re-measures it live (scroll in the capture phase, resize, size changes) and both the outline and the card follow that one measurement; the card's side is chosen from its real size, with an assumed size only before the first measurement.
Choices and alternatives:
flip({fallbackPlacements})). That would mean re-implementing the popover's focus handling, Escape and outside-click dismissal for this one card. Passing the measured height into the existing side choice is a few lines and reuses everything.Differences from the common pattern:
Out of scope:
Remote/SSH: nothing here crosses the SSH boundary. The browser pane is a local webview in the local app; the page script, the bridge and the card all run on the local machine.
Follow-up to #26596.
Visual Proof
Hidden test apps on macOS, same static test pages in both builds. Top row = before (
main9a64866), bottom row = after (this branch). Each row is consecutive frames left to right. The blue box is the picked element; the white outline and the note card should stay on it.Page scroll (frames: picked, then the page scrolled 100 / 200 / 300px). Before: the card already followed window scroll, but the outline stays behind (100 → 300px off). After: the outline stays on the element.
Scrolling a box inside the page (box scrolled 60 / 120 / 180px). Before: the outline and the card both stay where the element was (the card ends up 191px away). After: both stay on it, card 11px below.
Pane resize (right sidebar opened, then both sidebars, then both closed; the element is sized in % of the page, so it reflows). Before: the outline keeps the old size and position (up to 220px off) and the card drifts up to 315px off the element's center. After: both follow the reflowed element.
Page zoom (Cmd + twice while the card is open, 100% → 110% → 120%). Before: the outline keeps its unzoomed size and the card ends up on top of the enlarged element. After: the outline matches it and the card stays 11px below it.
Measured in every frame (card and element in the app's pixels, element mapped from the page with the page's zoom): after the fix the card's gap to the element stays 11px and the outline's offset from the element is 0 in every frame of the first three cases. In the zoom case the outline box could not be read numerically (two tabs had the same page open), so that one is judged from the images. Before the fix the gaps and offsets grow as listed above.
Final head (7e1151d): painted pixels checked in every frame
Re-run on a fresh hidden test app built from the final head. Each frame was captured twice, once as shown and once with the card hidden. The white outline was then measured from the screen pixels and compared with the element's live position. The card's painted edges came from the difference between the two captures. In every frame of every case below, and in the four cases above (page scroll, box scroll, pane resize, page zoom), the painted outline is within 1px of the element on each side and the card sits 11px from it (10.8–11.2px). The painted card matches the card the app laid out to the pixel. The frames are cropped around the element; each strip runs left to right.
Border and padding growth (picked, then the page's own script grows the element's border 2 → 10px, then its padding 10 → 18px). The outline grows with the element and the card moves down to stay 11px below it.
HTML preview (a second Orca connected to the first, so the
.htmlfile opens in the HTML preview beside its source, the same way a remote workspace's file does; picked, box scrolled 60 / 120px, then the page scrolled 80px). Same behaviour as a normal browser tab. A local.htmlfile opens as a normal browser tab, which the cases above cover.Add (note typed, Add pressed, then the page scrolled 100px). The note is saved (one saved note with the typed text), the card closes, no errors are logged, and the saved note's badge stays on the element as the page scrolls.
Page that already uses the selection marker attribute (the orange box comes first in the page and already carries the attribute; the clicked element carries its own value; picked, then the page scrolled 150 / 300px). The card follows the clicked element and never jumps to the orange box. After Cancel both elements have their original attribute values back.
Testing
New
src/main/browser/grab-guest-overlay-follow.test.ts: runs the real page script in a test DOM, clicks an element, then scrolls a box inside the page, resizes the window and changes the element's size, and checks the outline is redrawn at the new position each time; also checks the marker attribute is set on click and removed on teardown.New
src/shared/browser-annotation-viewport-live-target.test.ts: runs the real bridge script and checks it reports the marked element's live box after an inner-box scroll, a resize and a size change, and reports no box once the marker is gone.browser-annotation-geometry.test.ts: the live box replaces the click-time one (inner-box scroll, pane reflow), page-zoom conversion, and the measured card height changing the chosen side.Each of the 9 behaviour tests above fails with the fix reverted (checked by reverting the overlay listeners, the bridge's target report, and the geometry's use of the live box/scale/height).
Typecheck (web + node),
check:code-quality:changedandcheck:react-doctor:changedpass locally.I manually tested these changes locally (hidden test apps, macOS; see Visual Proof)
Automated tests added/updated
Agent skill upstream boundary
Notes
Security: the bridge's token stays in its isolated context; the only new page-visible thing is the marker attribute on the selected element while a note is open. Cross-platform: no platform-specific code. Performance: while a note card is open, one
getBoundingClientRectand one message per animation frame during scroll/resize, as the bridge already did for scroll.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Review validation
The review fixed marker collisions, live coordinate handling in HTML previews, and border/padding-only size notifications. Selected elements now use
ResizeObserverwithbox: 'border-box'; browser pages and previews share the protected report handler.The final hidden run at
5118ec23measured card movement after outer-box growth and scrolling, but its captured frames differ from measured card placement. Painted outline/card attachment, the HTML-preview flow and Add action remain unqualified. Final head7e1151ddadds only the exact upstream CI line-limit repair, with annotation files unchanged. The earlier author captures above are retained; the following frames document the unresolved final-run evidence discrepancy.Border growth, hidden CDP frame:
Page scroll, hidden CDP frame: