Repository navigation
fix(web): place nodes inside iframes in page coordinates - #4020
Conversation
agent-browser measures a node inside an iframe against that frame's viewport, so coordinate presses on iframe content landed on the page around the frame. Shift each such node by its frame's page position plus the frame's border and padding, read with one batched get styles call. Content of a frame that cannot be measured gets no rect. The WebView fixture gains same-origin, opaque-origin, and cross-site frames; the lab WebView allows them through originWhitelist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Size Report
Startup median (7 runs, lower is better):
|
|
Thanks for this. At 759a853 the code is not ready: nested iframes that are clipped at the top or left place their children wrongly, and the live evidence does not cover the states this change targets. CI is still queued or in progress, so I can't attribute any result yet. Before merge, the fix below and the live runs must land. The first fix is the nested-clip bug in agent-browser-snapshot.ts. Each frame should keep its unclipped page rect as the origin for its descendants, and every node should be clipped against the intersection of all ancestor frame viewports. Please add a test with a nested frame clipped at top and left. The web snapshot and press path changed, but the only live proof is prose about one probe page. That page has no nested frame, no frame scrolled inside the page, and no frame scrolled inside its own document. Those are the states the clip and nesting code exist for, and the unit doubles assert the arithmetic, not the backend's coordinate space. Please attach agent-browser 0.39 output for (a) a nested iframe partly scrolled above its parent frame's top edge, and (b) the main page scrolled so the iframe is offset. For each case, show the The test-app README says the cross-site Not blocking, and fine to take or leave: On the open inline threads, the P1 about the clipped rect feeding descendants (thread) still stands and is the fix above. The two P3 threads also still apply: narrowing originWhitelist and the frameGeometryExecutor double. |
A nested iframe clipped by its parent frame passed its clipped rect to its own content, shifting every descendant by the clipped amount. Each frame now keeps its unclipped viewport for placement and its visible part for clipping. Share one kernel intersectRects across web, selectors, maestro, and screenshot crops; read boxes and frame styles through one batched reader; narrow the test-app WebView whitelist to the schemes the fixture needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps attachDraftRects under the cognitive-complexity budget; also names the shared batch bound for both box and style reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The code fix from the earlier review is in place at 6f5e870, but two live-evidence gaps remain. The nested-clip arithmetic is fixed, and the two small test and The README claim at https://github.com/callstack/agent-device/blob/6f5e870/examples/test-app/README.md#L28 is still unanswered. It says the cross-site The projection in https://github.com/callstack/agent-device/blob/6f5e870/packages/platform-web/src/agent-browser-snapshot.ts#L129 is still unproven in the live states it exists for. The claim that agent-browser 0.39 lists no nested-iframe content is prose without output. No run covers a scrolled page, where the frame's These cubic-dev-ai threads are fixed at this commit and can be resolved: the clipped-origin bug in Before merge, the live runs above need to be attached, and the Coverage failure needs to be read and attributed. |
intersectArea importing kernel/rect grew the eager import closure of screenshot-geometry and both screenshot-diff entries. Restore its own arithmetic, and state the cross-site frame's README claim as measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Live evidence at Coverage failure: not the vitest-pool flake. Evidence page. Three frames sit below a 900px spacer, each with
Every in-frame button reports its click as a top-level viewport point. Same-origin frames compute it by walking CDP Raw, page
Presses through Test-app fixture, cross-site
Known limit: frames under a CSS |
|
I found no code problems at cdbea80. The Coverage failure from my earlier review is no longer listed as failing, and the live evidence you posted now matches the placement code. Smoke Tests is still running, not failed. This PR changes the web snapshot rect path, so that lane exercises it. It should finish green before merge. The earlier inline threads on frame origin from the unclipped rect, WebViewScreen.tsx and the provider rects test are all fixed at this head, so you can resolve them. Limits of this review: I checked the arithmetic in your live runs against the placement code but did not rerun them. Nested-iframe placement has unit-test coverage only, because agent-browser 0.39 does not list nested content. Frames under CSS |
|
Summary
On web targets, coordinate presses on elements inside an iframe missed. agent-browser measures a node inside an iframe against that frame's own viewport, so presses landed on the page around the frame.
The snapshot now places each such node from its frame's unclipped viewport (page position plus border and padding, read only when a page has iframes) and clips it to the part of the frame the page shows. Content scrolled out of its frame, or inside a frame that cannot be measured, gets no rect. Frames under CSS
transform: scale()orzoomare not scaled.Reuse: one
intersectRectsinkernel/rectreplaces copies in selectors and maestro and backsintersectScreenshotRect. Box and style reads share one batched reader.The test-app WebView fixture gains same-origin,
data:and cross-site iframes. Its whitelist adds onlyabout:srcdocanddata:, which the default blocks for iframes.Validation
Head
cdbea80368:pnpm check:affected --run --head cdbea80368passed, and so dideager-closure-budgets.test.ts.Out of scope: web
@refpresses fail with "no usable bounds" on main-frame elements too.🤖 Generated with Claude Code