Skip to content

macOS engine: a click on a frontmost web text field places a caret, as the vendor's does (#258) - #539

Merged
SSFSKIM merged 5 commits into
mainfrom
fix/258-text-click-caret
Nov 23, 2026
Merged

SSFSKIM merged 5 commits into
mainfrom
fix/258-text-click-caret

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Closes #258.

What

An element click on a web text field (AXTextField, AXTextArea, AXComboBox, AXSearchField or AXSecureTextField inside an AXWebArea) whose point hits the field itself now posts one plain click at the field's centre when its app is frontmost. That collapses a selection to a caret, as the vendor's click does. Before, cua pressed through AXPress, which kept the selection: #187 measured 20+7 kept on frontmost Electron, against a caret from the vendor.

The vendor's rule (static, new F §18)

  • Inside a web view (the element or an ancestor is an AXWebArea), the vendor hit-tests at the frame midpoint. If the hit is the element itself or a descendant, it posts a click; otherwise it presses (AXPick or AXPress). Outside a web view it always presses. No role is tested.
  • The hit-test is rooted at the application on both sides. F §5.1's "strict descendant" reading and M5's "window-rooted" hypothesis were wrong; §5.1 is marked corrected.

Scope (rulings 1159, 1167, 1170 and 1171)

  • Frontmost only. The gate uses route 3's existing frontmost test (frontmostIsTarget: the frontmost pid is the serving pid or the app pid, never key focus alone).
  • Delivery. The new carrier frontmostField (deliverFrontmostFieldClick, route 2′) runs the in-flight check, re-reads frontmostIsTarget immediately before posting, and posts one plain down/up to the serving pid. It does no activation, no FakeActivation and no ForegroundAssist. It keeps the minimized and not-visible refusals and the cursor and click-ordering hooks.
  • Front lost before posting. Nothing is posted. The click is recorded as webTextEntryFrontmostLost and carried by main's action route, through Safari: an element click on a textarea answers success while focus stays on the web area (false success) #313.
  • Everything else keeps main's route. That covers every background and shared-mode path (Chromium, Electron, Gecko, WebKit), native fields, and all other roles.
  • One lazy ancestry read per request (elementClickRoutes).

Declared gaps (all ticketed)

Proof

  • WebTextFieldClickTests: 17 tests. They cover frontmost synthesis on every engine and under route 4; background pins (key-focus split, Chrome datalist, Gecko, WebKit); the plan-to-delivery seam with the front lost under route 3 and route 4 (nothing posted, main's route); a helper-served field; the order of the in-flight check; and the native field's single ancestry read.
  • Red evidence: the P1 scenes fail on 31bc458 and ad20332 (scratch tests kept locally), and the mutations on the fix fail the intended tests.
  • swift test: 1758 tests, 1 skipped, 0 failures. The Xcode 27.2 release build passes.
  • Live proof: M5 sitting C's electron/frontmost/click.selection on hosted runners.

Review

Three reviewer-high rounds:

  • 31bc458: one P1 (an unguarded background mouse-down when key focus is held) and four P2s. Narrowed per 1170.
  • ad20332: one P1 (frontmost checked at planning, not at delivery) and one P2 (the helper-pid split). Fixed per 1171.
  • 21ee863: correct, no findings.

Plugin 0.29.14.

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

…hit of the element itself (refs #258)

The static reading for #258. The vendor gates a plain left click only when
isInsideWebView (the element or an ancestor is an AXWebArea, or the app is
Atlas), hit-tests from the application element as cua does, and its ancestor
search starts at the hit, so a point on the element itself synthesizes. §5.1's
window root and strict-descendant reading are marked wrong.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…d, not pressed (refs #258)

An element click on a text-entry role inside a web area now goes to synthesis
when the hit-test at its point answers the element itself, as the vendor's
click does (F §18), so it leaves a caret at the point where AXPress kept an
earlier selection (#187's cell 3 (i)). Native fields and every other control
keep their action. The click takes route 3's existing delivery and guards
(#200's delivery guard, #282/#283's element route in shared mode); the record
names the rung webTextEntry. Decision Log entry and the remaining divergences
in the tech-debt tracker.

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

Ruling 1170 narrows 31bc458 after its review. A web page's text field whose
point hits itself is synthesized only when the app is frontmost, by route 3's
own frontmost test (frontmostIsTarget, now shared with FakeActivation.deliver);
behind another app every engine keeps main's route, so a target owning key
focus behind the frontmost app is no longer posted outside the delivery guard
(P1), and the datalist's held AXPress, Gecko's press and WebKit's #313 route
stay. The gate and #313's route share one lazy web-area read
(elementClickRoutes), so a native field walks its parents once. The #258
Decision Log entry is rewritten for 1170, with both outcomes of a background
Chromium pointer stated.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ts plain (refs #258)

Ruling 1171, after the re-review of ad20332. A frontmost web text field
hitting itself is now carried by its own carrier (ElementClickCarrier
.frontmostField), not synthesizedClick: one plain left click (route 2')
to the field's serving process, no activation and no route-4 assist, the
front read again with the gate's frontmostIsTarget immediately before the
events. If another app came forward since the plan, nothing is posted and
main's action carries the click, recorded as webTextEntryFrontmostLost. A
helper-served field in the frontmost app gets the plain click too. The
key-focus early exit of activate()/deliver() for other clicks is unchanged.

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

chatgpt-codex-connector Bot commented Nov 23, 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-23T20:25:57.404228Z 21ee863 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 6baf3e3 into main Nov 23, 2026
7 checks passed
@SSFSKIM
SSFSKIM deleted the fix/258-text-click-caret branch November 23, 2026 20:41
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: an element click on a text field keeps its selection (AXPress), where the vendor's click places a caret

1 participant