Repository navigation
fix(ego-browser): hit-test parent documents before clicking inside an iframe - #812
wuwei-citro[bot] wants to merge 5 commits into
Conversation
… iframe page.click only ran its pointer-interception check in the target's own frame. Native input is routed from the top document down, so an overlay in a parent document that covers the iframe (for example a layui dialog shade in the top window over a form iframe) received the click while click() returned a successful receipt and the target never saw the event. Walk the iframe chain from the target's frame to the top Page, translate the action point into each owner <iframe>'s document and require that the element hit there is that iframe. A covered iframe now fails with the same transient "<x> intercepts pointer events" error as an overlay inside the iframe, so the retry loop waits for it to go away. The check covers same-process and out-of-process parents, runs again after the hover move for same-process iframes, is skipped with force, and also guards the activation click page.fill performs. Fixes CITRO-5655. Co-Authored-By: Claude <noreply@anthropic.com>
Verification on
|
🤖 Codex Review ·
|
…ents An interactive wrapper around an iframe with pointer-events: none passed interceptingElementAtPoint, yet the wrapper receives the native click. Co-Authored-By: Claude <noreply@anthropic.com>
Review round 1
|
Verification on
|
🤖 Codex Review ·
|
getBoundingClientRect is axis-aligned, so rotated or skewed iframes mapped the framed point to the wrong place in the parent document and reported a false interception. Map through the iframe's DOM.getContentQuads border-box quad instead, falling back to the bounding box when no quad is available. Co-Authored-By: Claude <noreply@anthropic.com>
Review round 2
|
Verification on
|
🤖 Codex Review ·
|
…or rotation Hovering a cross-origin iframe target can open a parent-document overlay after the first ancestor hit test, so recheck the ancestors before the press, as the same-process path already does. An iframe's content quad can carry an ancestor frame's rotation. Map it back into the owner document's viewport through the inverse affine transform given by the owner's untransformed root element quad, keeping the bounding-box alignment only as a fallback. Co-Authored-By: Claude <noreply@anthropic.com>
Review round 3
|
Verification on
|
🤖 Codex Review ·
|
…me quads Replace the three-corner affine interpolation with a projective (square-to-quad homography) map, for both the iframe quad and the ancestor root quad, so iframes styled with perspective() land on the right point in the parent document. Co-Authored-By: Claude <noreply@anthropic.com>
Review round 4
|
Verification on
|
🤖 Codex Review ·
|
Problem
page.click()checked for pointer interception only in the target's own frame. Native input is routed from the top document down. When an overlay in a parent document covered an iframe, the click landed on the overlay, butclick()still returned a successful receipt{}and the target never received the event. A common case is an admin UI that shows a dialog with a full-screen shade in the top window over a form iframe. An overlay inside the same iframe was already reported correctly (CITRO-5655, GitHub #798).Fix
assertFrameOwnersReceivePointerEventsinsrc/driver/page-actions.ts. It walks from the target's frame up to the top Page. At each step it resolves the owner<iframe>in the parent's session, translates the action point into that document (content-box offset, CSS scale) and runs the sharedinterceptingElementAtPointthere. If anything other than that iframe is hit, it throws the existing transient"<x> intercepts pointer events"ElementResolutionError, so the retry loop waits for the overlay to disappear, as it already does for same-frame overlays.iframeSessionsand itsparentFrameIds.page.clickruns the check before the first pointer move. For a same-process iframe it runs it again after the hover move, so overlays created by hover in the parent are also caught.force: trueskips the check.page.fillperforms runs the same check.resolveFrameOwnerhelper, shared withensureFrameOwnerInView.Verification
src/page-actions.test.mjs:forceskips the check.Page click hit targetnow covers the reproduction from the issue: asrcdociframe whose target is covered by a parent overlay, and by an overlay inside the iframe. Both reject without reaching the target, and the target receives the click once it is uncovered.npm --prefix package/ego-browser test: 674/674 pass.npm --prefix package/ego-browser run e2e:Page click hit targetpasses (26 assertions). Some unrelated cases failed in local runs, and the set changed from run to run (page-ledger checks, evaluate-timeout recovery, fresh-process pending navigation).Page actionabilitypassed in one run and exited early in the other.🤖 Generated with Claude Code