fix(cua-driver): preserve foreground focus during macOS clicks - #3530
Draft
RubinCarter wants to merge 2 commits into
Draft
RubinCarter wants to merge 2 commits into
RubinCarter wants to merge 2 commits into
Conversation
RubinCarter
force-pushed
the
fix/macos-target-only-synthetic-focus
branch
2 times, most recently
from
September 3, 2026 18:42
945a6a5 to
75cc516
Compare
Replace the background pixel-click focus-without-raise sequence with target-only synthetic focus. The action now fails closed when that route is unavailable and always tears down the target state without defocusing or reactivating the user foreground app. Salvaged from iFurySt/open-codex-computer-use#48. Co-authored-by: tisfeng <25194972+tisfeng@users.noreply.github.com>
RubinCarter
force-pushed
the
fix/macos-target-only-synthetic-focus
branch
from
September 3, 2026 18:47
9134033 to
b28de77
Compare
Journal Electron BrowserWindow focus transitions independently of DOM blur and require the macOS focus-loss canary to trigger the native signal. This catches AppKit resign/key-window regressions that leave document.hasFocus unchanged.
RubinCarter
force-pushed
the
fix/macos-target-only-synthetic-focus
branch
from
September 3, 2026 18:50
b28de77 to
f9325c8
Compare
This was referenced Sep 3, 2026
This was referenced Sep 5, 2026
6 tasks
This was referenced Sep 8, 2026
Closed
6 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refs #3331
Salvaged from iFurySt/open-codex-computer-use#48.
Validation
cargo fmt --all -- --checkcargo test -p platform-macos(362 passed, 2 ignored)cargo test -p cua-driver-testkit(56 unit tests and 2 integration-schema tests passed)cargo test -p cua-driver --test harness_appkit_test --no-runnode --check libs/cua-driver/tests/fixtures/apps/cross-platform/electron/main.jsPending native evidence
The local console session is currently locked (
CGSSessionScreenIsLocked=Yes). The covered-target focus test cannot establish an active/key foreground sentinel while locked, so no native focus-preservation result is claimed yet. After unlock the sentinel first runs a deliberate focus-loss/input-leak canary, then the background raw double click must prove target effect, target-only route use, unchanged frontmost PID, no native or DOM blur, unchanged real pointer, unchanged z-order, and safe user takeover.Known unrelated validation noise
cargo clippy -p platform-macos --all-targets -- -D warningsis currently blocked by pre-existing lints in cursor-overlay and other untouched platform-macos files under Rust 1.98.