Skip to content

Engine: a background click into a Chrome page is element-routed or refused on a shared desktop, delivered on a dedicated one, and never silently lost (refs #282) - #284

Merged
SSFSKIM merged 11 commits into
mainfrom
fix/282-chrome-first-mouse
Nov 6, 2026

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

A left click into a background Chrome page never reached the page, and cua reported success (#282). Route 3 posted no click at Chrome's activation point, which lies outside its frame, so the agent's own mouse down was the first one after the fake activation. AppKit took that down as the window's activating click: it made the window key, then asked the view whether it accepts first mouse. Chromium's web content answers no, so neither the down nor the up reached the page. This had been so since 5941e98 (2026-10-20).

The fix applies the owner's rule for input an app ignores, the Linux engine's device mode: on a shared desktop, refuse it; a dedicated desktop may bring the window forward. A hosted macOS runner proved it live (below).

Closes #282

What changes

Shared mode (the default):

  • A left click, double click or drag into a background Chromium web area is never posted as a mouse event.
  • The element route. A plain click resolves its hit to the nearest allowlisted control and performs that control's accessibility action.
    • The allowlist: AXButton, AXCheckBox, AXRadioButton, AXLink, AXPopUpButton, AXMenuItem, AXMenuButton, AXDisclosureTriangle, AXTab.
    • The walk goes up only through AXStaticText, AXImage and AXGroup. A button's hit is its label.
    • It refuses at an editable element, at any other role, at the AXWebArea, and on incomplete ancestry.
    • elementClick records the walk (walk, pressedRole, pressed, walkStopped).
  • The value check. A checkbox's or radio button's AXValue is read before the press and polled after it (every 20 ms, up to 500 ms). An unchanged value, or a baseline that can't be read, answers clickUnconfirmed.
  • The re-read. Chromium exposes its controls' actions only once its complete accessibility mode is on, about 1.5 to 1.7 s after the first observation. So for 10 s after a process's first observation, or after any enablement write attempt, an allowlisted control with no action yet is re-read every 100 ms for up to 2 s, with nothing posted. The control is then requalified as it is now before it is pressed.
  • Refusal. Anything else is refused as backgroundClickRefused: "<App>'s web page does not accept a background click; bring <App> forward or use a dedicated desktop". Where the control has no action, the sentence adds that the app should be observed first. Nothing is posted and no arm is left set.

Dedicated mode. Left pointers post the early inert click right after subtype 1, so the down meets a key window and is delivered. That action runs without the delivery guard or the after-action watch, as on Linux's foreground route.

Everywhere. A pointer whose own down consumed the arm (activationClickKind {action, consumedByAction}), in a view not known to accept first mouse, answers clickUnconfirmed (an error, with the full meta). It never answers plain success.

Which views are known to accept first mouse. A Chromium-family hit (BrowserCrApplication, AtomApplication) shown to lie outside any AXWebArea by an established walk, once a web area has been seen in the process; Chrome's toolbar is one. Everything else in a Chromium process is a possible web area: an incomplete walk, a missing hit, or a walk before any web area was seen.

The hit-test. The coordinate hit-test asked the window element, which answers −25201, so the hit was always nil; that also made main's sparing area a single point. It now asks the application element, and keeps the hit only when its first AXWindow ancestor is CFEqual to the target window.

The mode.

  • desktopModeFor resolves CUA_DESKTOP_MODE, else engine.json's desktop, else shared, now for macOS sessions on cua's engine too.
  • The service passes it in every connection's ping {clientApiVersion, desktop}. The engine keeps it per connection, and doctor reports it.

Docs and diagnostics.

Live proof (hosted macOS runner)

docs/evidence/2026-11-05-chrome-first-mouse/ holds run https://github.com/SSFSKIM/cua/actions/runs/42137289452, two reps that agree in every cell.

  • Config: macOS 26.6.2 (25G83), Chrome for Testing 156.0.8078.47, display 1024 × 768. The engine ran as a child of the job's shell, which holds the image's Accessibility and PostEvent grants.
  • main: the click is lost. Pointer 0/0/0/0 and no focus, yet success is reported.
  • Dedicated mode: delivered once (1/1/1/1, the textarea focused), with TextEdit still frontmost.
  • Shared mode:
    • The checkbox and the button (walk [AXStaticText, AXButton]) are element-routed and change exactly once. That holds at 0.09 s, 0.9 s and 3.4 s after the observation, and after ⌘L.
    • The textarea is refused with nothing posted.
    • Chrome's toolbar Reload still delivers.
  • Geometry: the frame and the AXActivationPoint read the same before and after subtype 1.
  • Earlier runs found the fixes in 8bc549a through d88fe34. The evidence README lists them.

Limits

  • In shared mode, a background Chrome click with no allowlisted control under it is refused. That includes a text field or text area, plain text, a double click, a drag, focusField's fallback, and a click right after a ⌘ key that lands on no control. The person keeps their window order, and the agent brings Chrome forward or uses a dedicated desktop. Focusing a text field without a click is macOS engine: a background Chrome text-field click in shared mode focuses the field through AXFocused, and says the caret was not placed #283.
  • The first click into a freshly observed Chrome can take up to about 2 s. The re-read waits for Chromium's complete accessibility mode; measured, the answer lands about 1.6 to 1.9 s after the observation. A click whose control never gets an action is refused after the full 2 s.
  • Chrome's toolbar before any page has been observed in that process counts as a possible web area: it is element-routed or refused.
  • Safari and Firefox aren't Chromium, and whether their views accept first mouse is unmeasured. A background click whose own down consumed the arm answers clickUnconfirmed there.
  • The measured config is Chrome for Testing 156 on macOS 26.6.2 and 26.7.2. Stable Chrome on the owner's Mac is unmeasured.
  • The engine's AXManualAccessibility write fails on Chrome for Testing (−25208, not implemented), yet complete mode arrives anyway. Whether the write takes effect despite the error is unknown.

Tests and review

Sminos-Session: cursor235#b93055dd (cua on macbook)

…ed or refused in shared mode, posts the inert click first in dedicated mode, and answers clickUnconfirmed where it may only have activated the window (refs #282)

The connection's ping names its device mode (desktop: shared | dedicated), kept per connection. A route-3 left pointer
meeting an activation that clicked no AXActivationPoint is refused before subtype 1 or any join in shared mode when it
points into a Chromium web area (backgroundClickRefused, nothing posted), or carried by the hit's AXPick/AXPress for a
plain click; dedicated mode takes the inert click early and skips the delivery guard and after-action watch for that
action; a consuming down into a view not known to accept first mouse answers clickUnconfirmed. rearmed only for a
shared-mode pointer into a known-accept view (Chromium's native views once a web area was seen).

Sminos-Session: cursor235#b93055dd (cua on macbook)
…n Linux, the service names it in each connection's ping, doctor reports it (refs #282)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…d, the spec's #282 Decision Log entry; 0.23.0 (refs #282)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…alk reached the window with every role and parent read; an incomplete walk is a possible web area, refused or element-routed in shared mode (refs #282)

The review of 739346e..8e85909 (one P2): insideWebArea answered false for a failed parent read, an unreadable role or
an exhausted bound, which classified a background page hit as accepting first mouse. webAreaWalk is now inside,
outside or incomplete; a Chromium hit not established outside every web area is possibleWebArea.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ly when its AXWindow ancestor is the target window (refs #282)

Found live on the hosted runner (probe/282-hosted): AXUIElementCopyElementAtPosition of a window element answers
kAXErrorIllegalArgument, so the coordinate click's, the drag's and the coordinate scroll's hit was always nil, and shared
mode posted a background Chrome click as clickUnconfirmed instead of refusing or element-routing it. A hit in another
window, or one whose ancestry cannot be read to a window, stays nil; a hit that is itself the window or application is
an incomplete web-area walk.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…t of controls, refuses text entry and editable regions, and answers clickUnconfirmed when a checkbox's or radio button's value does not change (refs #282)

The hosted A/B (run 42130746324) found AXPress on a page's AXTextArea answering success and doing nothing. The design
session's ruling (1ea561bc fe37aee9): AXButton, AXCheckBox, AXRadioButton, AXLink, AXPopUpButton, AXMenuItem, AXMenuButton,
AXDisclosureTriangle, AXTab (no AXToggle: Chromium exposes toggles and switches as AXCheckBox); anything else, or a hit
with an AXEditableAncestor, is backgroundClickRefused; a value-checked press polls its AXValue every 20 ms for up to
500 ms. The first-call paragraph says which clicks are carried.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ted control through plain children, and re-reads a fresh Chrome's late action for up to 2 s before refusing (refs #282)

The hosted probe (run 42131623237) showed the missing AXPress is Chromium's accessibility enablement coming up (1.6 to
1.7 s after the engine's write), and a button refused at its label's point. The design session's bounds (1ea561bc
7a6a3638): the walk passes only AXStaticText, AXImage and AXGroup, refuses at an editable element, another role, the
AXWebArea or an unread ancestry; the re-read runs every 100 ms for up to 2 s where the last enablement write is under
10 s old or no web area was seen, posting nothing; elementClick names the pressed role and whether it was the hit.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…lkStopped on a refusal), roles only (refs #282)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…Unconfirmed, and the chosen control is requalified after the re-read before anything is posted (refs #282)

The re-review of c768d2b..1c8f222 (two P2s): a checkbox whose first AXValue read failed was pressed and answered
success; and the 2 s re-read checked only the control's actions, so a node that changed during the wait was pressed under
its old role. Now the press goes ahead and answers clickUnconfirmed without a baseline, and webAreaPressDecision
requalifies the control (allowlisted role, not editable, ancestry read to the AXWebArea) and takes its action and value
check under its current role, refusing with nothing posted otherwise.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…n or any enablement write attempt, failed or not, and the observation reports the write and its AXError (refs #282)

The final hosted A/B (run 42134748488): on Chrome for Testing the enablement write fails, so freshness keyed on a
successful write never opened and every shared-mode click within a second of the observation was refused without the
re-read, though Chrome reached its complete mode 1.1 to 1.6 s after the observation. EnablementAccess.write now answers
the AXError; WebAccessibility.freshSince is the later of the first observation and the last write attempt;
enablementWrite and enablementWriteError ride in the observation's diagnostics.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ick; shared mode element-routes or refuses; dedicated delivers once)

Sminos-Session: cursor235#b93055dd (cua on macbook)
@SSFSKIM
SSFSKIM marked this pull request as ready for review November 6, 2026 01:05
@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-06T01:07:27.250190Z c284e36 Draft marked ready
ℹ️ 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.

@SSFSKIM

SSFSKIM commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Update from #287: the configs this PR's Limits named as unmeasured are now measured (hosted macOS, main's engine at 51b473f, 2 reps).

Findings: #287 (comment)
Evidence: https://github.com/SSFSKIM/cua/blob/main/docs/evidence/2026-11-07-other-browsers/README.md

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.

macOS engine: a left click into a background Chrome page is swallowed as the window's activating click, and cua reports success

1 participant