Skip to content

fix(desktop): clicking a preview field in an inactive macOS window now types into it - #31777

Open
dpearson2699 wants to merge 1 commit into
pingdotgg:mainfrom
dpearson2699:fix/macos-first-click-preview
Open

dpearson2699 wants to merge 1 commit into
pingdotgg:mainfrom
dpearson2699:fix/macos-first-click-preview

Conversation

@dpearson2699

Copy link
Copy Markdown

Problem

On macOS, clicking a field in the embedded Browser preview and typing should put the text in that field. When the click is the one that brings the T3 window to the front, the text lands in the chat composer and the field stays empty (#22095). This hits sign-in pages hardest, since the workaround of having the agent type for you does not suit passwords.

Electron's acceptFirstMouse defaults to false on macOS, so the click that activates the window never reaches the page. Focus stays in the composer, and the keys follow it. Windows and Linux deliver that click, which is why it did not reproduce there.

Change

Set acceptFirstMouse: true on the macOS main window, so the activating click reaches the web contents like any other click. As a side effect, a click on an inactive window now also acts on whatever it lands on, buttons included.

Scope and approval

Fixes #22095, which is triaged as accepted. A comment from whoisaldo on the issue proposed this same one-line change and left the click-through decision to maintainers. Preview popups, the splash, and the recovery window have no composer, so they are unchanged.

Verification

Proved on a dev desktop build (macOS 27, Electron 44.10.1) with real OS mouse and keyboard events (CGEvent), against a page with a top-frame input and a cross-site out-of-process iframe input.

Scenario Before After
T3 focused, composer focused, click iframe field, type test field 3/3 field 3/3
Finder in front, one click on the cross-site iframe field activates T3, type test composer 4/4, app logs app got key t focus:DIV field 10/10, host activeElement is WEBVIEW, no app keydowns
Same, clicking the top-frame field composer 3/3 field 4/4

On main, the page logged no pointerdown in any frame for the six activating clicks. Each focused click logged one.

Before After
before after

vp run check:changed passes. I added no test because the change is a BrowserWindow constructor option, and a test would only mirror it. Not checked: the packaged Nightly, the App Store Connect page itself, and a preview opened by an agent through preview_open.

Reviewed with sol-loop: 1 round with gpt-6.1-sol on high. Sol verdict: approved

Created with Claude Opus 5.5 in Claude Code, running in T3 Code.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T02:34:06.562642Z 9f3a5b3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 6, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — This fixes preview-field focus by allowing the first click into inactive macOS main windows. It also changes the default interaction for buttons throughout those windows, requiring a human decision on that broader click-through behavior.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 33d2adf08664ae4da0b9211128acd59ebef823c0 and 4522513.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
Walkthrough

On macOS, DesktopWindow.createWindow now sets acceptFirstMouse: true alongside disableAutoHideCursor. Other platforms receive neither option.

Changes: macOS Window Input

Layer / File(s) Summary
macOS window options
apps/desktop/src/window/DesktopWindow.ts
The macOS window options add acceptFirstMouse: true and retain disableAutoHideCursor. Other platforms receive no additional options.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · previous review 33d2a

On macOS, clicking an inactive window now also activates the control under the click, which lets keyboard input reach preview fields. No concrete regression risk was found. The author reports manual verification on macOS. A native-input automated test is not practical in the current infrastructure.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: clicking a preview field in an inactive macOS window now types into it. The raw summary shows DesktopWindow.createWindow enabling acceptFirstMouse on macOS, which addresses…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the bug, expected behavior, and environment. The Change section explains the o…
Linked Issues check Passed [#22095] The objective is that physical keyboard input after a physical click in a cross-origin iframe field in the macOS embedded preview enters that field. The whole-PR diff against the merge base c…
Out of Scope Changes check Passed [#22095] The whole-PR diff changes only the macOS main window options in DesktopWindow.ts. The new option acceptFirstMouse: true implements the fix for #22095. The PR description names the side effe…
Full details: Title check

Explanation

The title names the change: clicking a preview field in an inactive macOS window now types into it. The raw summary shows DesktopWindow.createWindow enabling acceptFirstMouse on macOS, which addresses this behavior. The title follows conventional commit form and is specific, so it describes the main change.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the bug, expected behavior, and environment. The Change section explains the one-line fix and its side effect. The Scope section links issue #22095 and states why the change is limited to the main window. The Verification section gives a results table, before and after screenshots, what was not checked, and the agent model used. The template asks for a conventional commit title, and the title meets that requirement.

Full details: Linked Issues check

Explanation

[#22095] The objective is that physical keyboard input after a physical click in a cross-origin iframe field in the macOS embedded preview enters that field. The whole-PR diff against the merge base changes one option in apps/desktop/src/window/DesktopWindow.ts. On darwin, the main window now sets acceptFirstMouse: true next to the existing disableAutoHideCursor: true. This lets the click that activates an inactive window reach the web contents, so focus moves to the clicked field. The PR description reports before and after CGEvent results on macOS 27 with Electron 44.10.1, including a cross-site iframe field. I did not re-run that verification. The change since the previous review is a comment addition and reformatting of the same option, with no behavioral change. No automated test was added. The issue does not require one, and the change is a constructor option. Non-coding checks (packaged Nightly, App Store Connect page, preview_open) are not coding requirements.

Full details: Out of Scope Changes check

Explanation

[#22095] The whole-PR diff changes only the macOS main window options in DesktopWindow.ts. The new option acceptFirstMouse: true implements the fix for #22095. The PR description names the side effect: a click on an inactive main window also activates controls under the click, including buttons. This is a direct consequence of the chosen fix and is disclosed. Preview popups, splash, and recovery windows use other constructors and are not changed by the diff. No unrelated file changes appear in the reviewed diff.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Wladefant

This comment was marked as spam.

@@ -403,7 +403,10 @@ export const make = Effect.gen(function* () {
minHeight: 620,
show: false,
autoHideMenuBar: true,
...(environment.platform === "darwin" ? { disableAutoHideCursor: true } : {}),
// Without it, macOS drops the activating click and keys stay in the composer, not the preview.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of dpearson2699

Agreed. Whole-window click-through is a product call for maintainers, and this PR does not try to make it.

On replay, here is what I observed. In the post-fix runs, the test page logged a trusted pointerdown per click. 17 real OS clicks (3 into an already focused window, 14 that activated it) produced exactly 17 pointerdown events across the top frame and the cross-site iframe. The closest two were 6 s apart, and every run's keys arrived once as test. So each activating click reached the page once, with no second delivery.

The check on a T3 control, such as one activating click on "Toggle right panel", was not run. My only basis for expecting the same there is an inference. acceptFirstMouse lets the window's view accept the original mouse-down instead of swallowing it. It does not synthesize a second event.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 1

apps/desktop/src/window/DesktopWindow.ts-484-484: 1

484-484: Major · Maintainability & Code Quality · Heavy lift

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Add a regression test for inactive-window focus.

No test covers the reported failure. Add a macOS test that activates the window by clicking a cross-site iframe input, then verifies that keyboard input reaches that field rather than the composer. The test must exercise native focus behavior; checking the constructor option alone would not catch the regression.

As per coding guidelines, “Logic, data, state, and protocol bugs get a failing test first.”

Source: Coding guidelines

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9f3a5b34bb995000df067b7e6fd0bafc0b78c2e6 and 33d2adf08664ae4da0b9211128acd59ebef823c0.

Files selected for processing: 1

  • apps/desktop/src/window/DesktopWindow.ts

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

@dpearson2699

Copy link
Copy Markdown
Author

Note

🤖 Claude Opus 5.5 responding on behalf of dpearson2699

Not adding this test. The repo has no harness that can run it.

The bug only appears when a real OS click activates an inactive window. Electron delivers clicks it synthesizes, and clicks sent to an already focused window, either way. So a test that would fail on main needs a macOS runner with Accessibility trust to post CGEvents, a second app to take focus, and a launched desktop build. CI has no Electron end-to-end setup, and its one macOS job only runs mobile static analysis. Building that harness is a separate project. A test that only checks the constructor option would just repeat the line, as CodeRabbit's walkthrough also notes.

The proof for this change is the before and after runs in the PR description: real CGEvent clicks against a cross-site iframe field. The composer got the text 4/4 times before the fix. The field got it 10/10 times after.

This branch has not been deployed

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

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Typing after clicking a field inside a cross-origin iframe in the preview goes to the chat composer

2 participants