Skip to content

Engine: a text field's element click outside Chromium answers success only when its focus reads back, never writing AXFocused (#313) - #322

Merged
SSFSKIM merged 6 commits into
mainfrom
fix/313-safari-textarea
Nov 7, 2026

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Summary

In Safari, an element click by token on a textarea answered success while nothing was focused, and typing went nowhere. Now a text field's element click outside Chromium answers success only when its focus reads back.

Closes #313

The rule (design session rulings cb252e88 and c4108490; the spec's #313 Decision Log entry)

Outside Chromium, an element click on a text-entry role (AXTextField, AXTextArea, AXSearchField, AXComboBox or AXSecureTextField) whose ladder chose its action works like this:

  1. AXPress first, then focus is read back within textEntryFocusSettleMs: 300 ms, polled every 20 ms.
  2. On a WebKit page only, if focus didn't read back, the engine writes AXSelectedTextRange: the caret at the element's point, using macOS engine: a background Chrome text-field click in shared mode focuses the field through AXFocused, and says the caret was not placed #283's box scan, or else {0,0}. It then reads focus back again.
  3. Success only on a true focus read. Otherwise the answer is clickUnconfirmed. The meta's elementClick.focus records readBack, notReadBack or unread, alongside focusStep.

The engine never writes AXFocused outside Chromium.

The caret is claimed only when it reads back (review round 3).

  • caret: placed means AXSelectedTextRange read back as written. Otherwise it is selectionMismatch, and the focus success stands.
  • A password field is classified first, and its range is never read (secure).
  • A failed write is recorded as caretWriteError.

Plugin 0.27.4.

Limits

  • A text field that never exposes AXFocused now answers clickUnconfirmed where its action alone used to answer success. No native field reached this path live: none advertises AXPress.
  • A WebKit field that neither step focuses takes two settles, about 600 ms, before clickUnconfirmed.
  • The caret read-back went unexercised live. A Safari textarea holding text is clicked by the unchanged synthesized path. The selectionMismatch and caretWriteError paths are proven by unit tests only.
  • Recorded, with no action: in Firefox, after a clickUnconfirmed, a following type_text can still land in the intended field.

Live proof (GitHub-hosted macOS, 2 reps, main b27ceb3 against the branch; frontmost app and window order recorded for every cell)

Evidence is in docs/evidence/2026-11-07-text-entry-click/.

Check Main Branch
Safari textarea, by token success with nothing focused (false success) focused by the caret step, type_text lands, Safari stays behind TextEdit
Safari text field success through AXPress the same, no raise
Firefox text cells (10) success through AXPress the same; the first build answered clickUnconfirmed
Native fields, and Chromium including #283's cells – identical
Shared-mode raises 0 0
Firefox focus latency after AXPress (152 clicks) – p99 234 ms, max 271 ms, so the 300 ms settle covers them

The A/B surfaced one more problem, on the unchanged synthesized path on both heads. In shared mode, a posted click in Safari raised Safari's window over TextEdit's, 1 of 2. It is not this change's code, and it is #321.

Runs:

Tests and review

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

#283's route, and any text field's action answers success only once its focus reads back (refs #313)

Safari's AXPress on a page's textarea answered success and left the focus on the web area (#287's cells, 2 of 2). Per the design session's ruling cb252e88: outside Chromium a text-entry element the ladder gave an action takes #283's AXFocused route, read back; anywhere else (a native field, a Chromium field advertising AXPress) the action is followed by an AXFocused read, and a field that never reads focused answers clickUnconfirmed. Decision Log entry for #313; plugin 0.27.4.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…focus; an unread focus is polled and unconfirmed (refs #313)

The review of b27ceb3..2c37097 (one P1): an unread first focus read stood as success, but the live read discards every AX error, so a messaging failure or an invalidated element looked like a field without the attribute. Unread samples are now polled within the same 300 ms settle, and only a read of true is success; elementClick.focus still says unread or notReadBack. Decision Log entry updated with the rule and its cost.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…Focused; its action, then on WebKit its caret, each read back (refs #313)

The hosted A/B of 06c9035 (run 42402098567): WebKit takes an AXFocused write by raising Safari, and a background Firefox ignores it. Per the design session's ruling c4108490: the action goes and its focus is read back within textEntryFocusSettleMs (300 ms); a WebKit page's field still unfocused gets AXSelectedTextRange at the point's offset (else 0) and is read back again; success only on a read of true, else clickUnconfirmed. #283's AXFocused route stays Chromium's alone. Gecko is told by its principal class. Decision Log entry amended with the rule and the A/B.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ack, and the write's AXError is kept (refs #313)

The review of 06c9035..8d1025c (one P2): the caret's computed offset was reported as placed, with the write's AXError discarded and only focus checked. Once the field reads focused, AXSelectedTextRange is now read and polled within the settle for {offset, 0}: placed (or at the start) only on a match, else selectionMismatch with a note that claims no place; a password field's range is never read (secure). A failed write is recorded as caretWriteError. The focus success and its true-read requirement are unchanged.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…h no point is secure and its range never read (refs #313)

The re-review of 8d1025c..d3fa177 (one P2): the live caret callback answered pointOutsideText for a missing point before it checked for a password field, so such a field reached the range read-back and could be claimed at the start. textEntryCaretOffset now classifies security first, then the point, then the box scan, and the engine calls it.

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

Sminos-Session: cursor235#b93055dd (cua on macbook)
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T20:54:58.935612Z d1250f3 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.

@SSFSKIM
SSFSKIM merged commit 602b709 into main Nov 7, 2026
5 checks passed
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.

Safari: an element click on a textarea answers success while focus stays on the web area (false success)

1 participant