Repository navigation
fix(browser): count clicks inside embedded frames as page input - #42823
Conversation
…page input Electron's input-event only observes the main frame's widget, so a click in an out-of-process iframe never released a quieted prompt, funded a popup or ended an agent's lead. Mouse activation now comes from before-mouse-event, which fires for every frame.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
When you clicked inside a box embedded in a web page (a sandboxed frame, or a frame from another site), Orca's browser didn't notice the click. So things that wait for "the user clicked" never happened. The clearest case: after you press Cancel on "Open Visual Studio Code?", the page is supposed to be allowed to ask again once you click in it. Clicks inside such a frame didn't count, so the prompt never came back until you clicked somewhere else on the page.
What Changed
Before: a click inside an out-of-process frame (any sandboxed iframe, or one from another site) did not count as user input in the embedded browser. That missed click didn't:
After: clicks in any frame count, and they are still tagged as agent input when an agent sent them.
How:
onActivatingBrowserGuestInputinbrowser-guest-input-gesture.tsis now the only place that subscribes to activating input:before-mouse-event.input-event.Why
Electron's
input-eventonly observes the main frame's widget (RenderFrameHostChanged/OnInputEventinshell/browser/api/electron_api_web_contents.cc). Chromium puts sandboxed and cross-site iframes in their own process with their own widget, so clicks there never reach that observer.before-mouse-eventcomes fromWebContentsDelegate::PreHandleMouseEvent, which runs for every widget of the page.I checked this with a hidden Electron 43 test page (same Electron as Orca) with four sandboxed frames. CDP clicks in each frame fired
before-mouse-eventand opened the frame's link, but fired noinput-event. A click on the top document fired both. Taking mouse input only frombefore-mouse-eventcounts each click once.Keyboard activation inside such frames is still not seen. In the same test, keys sent into the frame fired neither
input-eventnorbefore-input-event, so there is no Electron event to listen to. It fails closed: the page just doesn't get credit for those keys.This is the first of two PRs for remembering "open another application" choices. The next one only uses a saved choice right after the user's own click, and the reporter's links live in sandboxed frames.
Linked Issue
#38105 (part 1 of 2; the feature PR follows on this one).
Visual Proof
N/A: nothing on screen changes. The visible effect is that a prompt can show again after you click inside an embedded frame. The feature PR's screenshots cover that path.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Electron check: the hidden Electron 43 test page described above, on macOS.
Updated tests: the prompt quiet test, the popup routing, page-prompt routing, eligibility wake and route popup tests now deliver clicks as
before-mouse-event, which is how Electron delivers them.pnpm check:changedpassed.Live, macOS, hidden dev build, using a page whose link sits in a sandboxed
srcdocframe. The clicks were sent over the guest's own CDP target, so they weren't tagged as agent input.Not tested: Windows and Linux. The Electron event is the same on all three.
Risk
The riskiest part is that mouse input now comes from a different Electron event.
before-mouse-eventmissed some mouse path thatinput-eventsaw, a click would no longer count as activation. The page would then refuse a popup or stay quiet until the next click or key.PreHandleMouseEventbefore it reaches the page, and the only other listener that callspreventDefaultdoes so only formouseWheel.Set.hasper mouse move on each guest, and no IPC.Level: Low
AI Disclosure
Review
Two reviewers (Codex and a Claude subagent), one round. Codex had no findings. Claude raised one P2: the helper's comment overstated keyboard coverage inside frames. I fixed the comment, and the keyboard gap is described above.
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
withAgentInputInjection, because CDP mouse events reachbefore-mouse-eventwhile the command is in flight.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)