Skip to content

fix(browser): count clicks inside embedded frames as page input - #42823

Merged
AmoabaKelvin merged 1 commit into
mainfrom
fix/iframe-clicks-count-as-input
Nov 15, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
fix/iframe-clicks-count-as-input

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42 $\color{#cf222e}{\Huge{\mathbf{−}}}$​34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8

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:

  • let a page that went quiet after a Cancelled or expired prompt ask again;
  • fund a popup or new tab the frame opened from that click;
  • end an agent's lead on the page;
  • update the profile's "last user input" record that extensions use.

After: clicks in any frame count, and they are still tagged as agent input when an agent sent them.

How: onActivatingBrowserGuestInput in browser-guest-input-gesture.ts is now the only place that subscribes to activating input:

  • Mouse presses and releases come from before-mouse-event.
  • Keys, touch and taps still come from input-event.
  • The gesture tracker, the per-session input record and the prompt quiet release all use it, so they agree on what a click is.

Why

Electron's input-event only observes the main frame's widget (RenderFrameHostChanged / OnInputEvent in shell/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-event comes from WebContentsDelegate::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-event and opened the frame's link, but fired no input-event. A click on the top document fired both. Taking mouse input only from before-mouse-event counts each click once.

Keyboard activation inside such frames is still not seen. In the same test, keys sent into the frame fired neither input-event nor before-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.

    • With the production change reverted, 5 of them fail, including "keeps a page quiet ... until the user acts on it".
    • With the change, all 30 tests in those files pass.
  • pnpm check:changed passed.

  • Live, macOS, hidden dev build, using a page whose link sits in a sandboxed srcdoc frame. The clicks were sent over the guest's own CDP target, so they weren't tagged as agent input.

    • On main: after Cancel on the "Open …?" prompt, clicking the link in the frame again showed nothing.
    • With this change (tested on the stacked feature branch): the same click showed the prompt again.
  • 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.

  • If before-mouse-event missed some mouse path that input-event saw, a click would no longer count as activation. The page would then refuse a popup or stay quiet until the next click or key.
  • Every activating mouse type goes through PreHandleMouseEvent before it reaches the page, and the only other listener that calls preventDefault does so only for mouseWheel.
  • There's one Set.has per mouse move on each guest, and no IPC.
  • Back out with a plain revert.

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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Security: both events come from input in the browser process, so a page can't fake them. Agent and remote-viewer input is still tagged by withAgentInputInjection, because CDP mouse events reach before-mouse-event while the command is in flight.
  • Cross-platform: these Electron events are the same on macOS, Linux and Windows.
  • SSH/remote: route (client-hosted) guests use the same tracker.
  • Mobile: not affected.
  • Performance: no measurable cost.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…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.
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Browser guest activation tracking now handles mouse-down and mouse-up events through before-mouse-event, and other configured activating input types through input-event. Session input recording, gesture tracking, and quiet prompt release use the shared listener. Related tests now dispatch simulated mouse events through before-mouse-event.

Merge Risk: Minimal · up to 39a53

Clicks inside sandboxed and cross-site frames now count as user input, so prompts, popups and agent-lead handling should behave correctly. No concrete defects were found. The remaining uncertainty is that Windows, Linux and a live iframe click were not tested.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: clicks inside embedded frames now count as page input. It also uses the conventional fix(browser) prefix. The title is specific and matches the changeset, which switch…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template and covers ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Risk, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist. It exp…
Full details: Title check

Explanation

The title names the main change: clicks inside embedded frames now count as page input. It also uses the conventional fix(browser) prefix. The title is specific and matches the changeset, which switches mouse activation to before-mouse-event so out-of-process frame clicks are observed.

Full details: Description check

Explanation

The description follows the repository template and covers ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Risk, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist. It explains the mechanism (before-mouse-event versus input-event), the reason for the change, the test evidence, and the risk and rollback plan. The Linked Issue section cites #38105 as part 1 of 2. The AI Disclosure section is blank, but the template marks it optional for internal contributors. The remaining gaps are minor: the Level field is set to Low, and the Testing section states that Windows and Linux were not tested.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f5148de3-2a2d-47e1-8b41-6ef5857458f1
Commits

Reviewing files that changed from the base of the PR and between 5b53483 and 39a53b5.

Files selected for processing: 7

  • src/main/browser/guest-lifecycle/input/browser-guest-input-gesture.ts
  • src/main/browser/guest-lifecycle/manager/popups/browser-manager-popup-routing.test.ts
  • src/main/browser/guest-lifecycle/manager/registration/browser-guest-eligibility-wake.test.ts
  • src/main/browser/guest-lifecycle/manager/registration/browser-manager-page-prompt-routing.test.ts
  • src/main/browser/guest-lifecycle/prompts/browser-page-prompt-quiet.ts
  • src/main/browser/guest-lifecycle/prompts/browser-page-prompts.test.ts
  • src/main/browser/routing/guest-authority/browser-route-guest-popups.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant