Repository navigation
macOS engine: a click on an open menu's item is delivered as the item's action and confirmed, not posted to close the menu (#454) - #462
Conversation
…as the item's own action, confirmed by its effect, or refused (refs #454) Design ruling 946. Every menu #454's kit measured is a layer-101 window of the app's own over the point, and the posted click only closes it (45/45 ok, nothing taken), while the item's AXPick takes it (45/45). After the stale-point guard keeps a plain left click's point, and before anything is posted: when the app's hit-test (in time) answers an AXMenuItem of an AXMenu, a window of the app's at layer 101 lies over the point, and the item is the one the observation recorded there (the node, a recorded item above it, or #433's control beneath: Chrome's <select>), enabled, the click is the item's AXPick (else AXPress) by route 1 in every mode; it answers success only once the menu's window has left the screen and the control the menu belongs to (the AXMenu's pop-up button, else the app's focused pop-up or combo box) reads the item's title, else clickUnconfirmed. Disagreeing signals, a disabled item or no action refuse as appWindowOverPoint with the menu's sentence. No pointer event is posted on either branch; an unread or late hit-test and a menu with no window of its own keep main's path. Meta `menuItemClick`; `WindowHit.answered` carries the hit-test's own answer. Sminos-Session: cursor235#b93055dd (cua on macbook)
… of other menus in the Decision Log, and the meta's menuItemClick (refs #454) Sminos-Session: cursor235#b93055dd (cua on macbook)
…e item's action, when it is unconfirmed or refused, and the ways through (refs #454) One sentence after #452's sentence of the stale-point paragraph, in agent-cursor.md, the test's expected text and the parity docs oracle; the surface inventory's Table 3 amendment and PROVENANCE.md record it. Sminos-Session: cursor235#b93055dd (cua on macbook)
…d as the item's own action, or refused (refs #454) Sminos-Session: cursor235#b93055dd (cua on macbook)
…ce from a control identified before the action, the judged re-hit, the item's title, page menus, an unread list, ambiguous action errors, and getAXState in both refusals (refs #454) The review of fdd285d..32787ce (reviewer-high): (1) the process serving the item is refused when forbidden and registered as driven before the in-flight check; (2) the control's selection (AXValue, its AXTitle only without a value) must move to the item's title from another before the action, else unconfirmed (`unchanged`); (3) that control is identified before the action: the AXMenu's pop-up or combo-box parent, or for a parentless menu the focused one, and a menu with any other parent has none; (4) the guard's re-hits go through LatestHit, so the menu step reads the timed outcome of the hit the guard judged; (5) the recorded item's title rides with it and a live item reading another is refused (`relabelled`); (6) a menu item inside a web area is main's, whatever window lies over it; (7) the window list is read as optional numbers, unread being unknown, never closed; (8) a messaging timeout from the action is judged by the effect, any other error is actionFailed; (9) the meta's delivery is set at dispatch; (10) #454's and #452's appWindowOverPoint sentences name getAXState(), not getScreenshot, whose answer is an image. Sminos-Session: cursor235#b93055dd (cua on macbook)
…enuItemClick fields (refs #454) Sminos-Session: cursor235#b93055dd (cua on macbook)
…the item, and the item already chosen is unconfirmed (refs #454) Sminos-Session: cursor235#b93055dd (cua on macbook)
…iled reads no evidence, the verified title carried and re-read before the action, page items under a native menu refused, titles compared as recorded (refs #454) The re-review of 32787ce..3eb2b80: (1) title and value read as text, absent or failed; the selection's attribute is chosen once before the action (AXValue, AXTitle only where the value is absent) and read the same after it, a failed read giving no evidence; (2) the title the decision verified rides in MenuItemTarget, judges the selection, and is read again just before the action, another or a failed read refusing as relabelled with nothing performed; (3) a page (ARIA) item is main's only when no native item is recorded at the point: with one recorded and its menu window over the point it refuses (notHit); (4) the live title is decoded as text or attributed text and cut as the observation cuts what it records (`bounded`) for the identity comparison, the full title kept for the selection. Sminos-Session: cursor235#b93055dd (cua on macbook)
…ption agrees with the record, a <select> menu's control is found by its options, and a menu the screenshot does not show is refused as such (refs #454) Run 44860009214 on c83ed84: (1) select-same refused notRecorded 15/15 because the deepest recorded node at One's point is the page's own AXPopUpButton, which acts, so neither it nor #433's control beneath was the item; every recorded AXMenuItem whose shown frame holds the point now counts (`recordedMenuItems`), and the hit agrees with any of them. (2) select answered value "unread" 15/15, the focus not on the <select> while its menu is open; a parentless menu's control is now the one recorded pop-up or combo box whose own AXMenu lists the same option titles in order (`parentlessMenuOpener`), the focused one only as the fallback. (3) menubar and submenu refused notRecorded with a sentence claiming the item differed from the screenshot, which shows no such menu; a hit on a native item with no recorded menu item at the point is now `unobserved`, its sentence saying the screenshot does not show the menu, that a click outside closes it, and that its items can be clicked by element once getAXState() lists them, with no keys advice (keys took them only frontmost). Sminos-Session: cursor235#b93055dd (cua on macbook)
…what works with the app behind (refs #454) Sminos-Session: cursor235#b93055dd (cua on macbook)
…Log, and the meta's unobserved refusal (refs #454) Sminos-Session: cursor235#b93055dd (cua on macbook)
…tified row stands, the <select> control needs complete evidence within a budget, the deadline is checked before the action, and the unobserved sentence names the record (refs #454) The review of c83ed84..74c99b9 (reviewer-medium): (1) the recorded item the guard identified stands, and only when a node of another role won is the one recorded item holding the point taken, if exactly one does (`RecordedMenuItems`); a neighbour row on a shared edge is never taken for it. (2) A parentless menu's control is named only on complete evidence: any failed read, or more candidates than the limit, answers unknown (`MenuOpenerSearch`), which leaves the click unconfirmed with no focus fallback. (3) The search has a 100 ms budget and stops at a second match, and the request's deadline is checked before the action (timeoutReached, nothing sent). (4) `unobserved` says the accessibility record holds no item of the menu at the point, and offers the element route only if a fresh getAXState() lists the item. Sminos-Session: cursor235#b93055dd (cua on macbook)
…ed, and the item is clicked by element only if a fresh getAXState() lists it (refs #454) Sminos-Session: cursor235#b93055dd (cua on macbook)
…sion Log (refs #454) Sminos-Session: cursor235#b93055dd (cua on macbook)
…he PR head (refs #454) Sminos-Session: cursor235#b93055dd (cua on macbook)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9031ae151e
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for item in items { | ||
| guard let role = reads.role(item) else { return nil } | ||
| guard role == kAXMenuItemRole else { continue } | ||
| guard let title = reads.title(item).text else { return nil } |
There was a problem hiding this comment.
Enforce the opener-search budget inside menu-item walks
For a parentless menu with many options or slow accessibility responses, titles() performs a role and title read for every item without checking the 100 ms budget. The only time check is at candidate-loop entry, so reading the displayed menu can substantially exceed the budget, and reading the last candidate can even return .found after it expires. Running this function with simulated 10 ms role reads returned .found after 1,030 ms despite the 100 ms limit. Since coordinate clicks now synchronously run this search before dispatch, large menus can stall the request or exhaust its deadline before the item action is sent. Check the remaining budget during both the item and child walks and before returning a match.
Useful? React with 👍 / 👎.
Closes #454. Refs #456 (its tech-debt-tracker line now points at it). Version 0.28.24. Design ruling 946.
The bug
On main, a coordinate click on an item of an open pop-up menu was posted and answered ok. The menu closed, but the item was never taken: 0/45 across Chrome
<select>, TextEdit's font pop-up and Script Editor's language pop-up, in all three modes.The menu tracks the real cursor, and needs a mouse move onto an item before it takes it. A pointer post can't do that without moving the person's cursor, and stamping the post to the menu's own window doesn't help (0/30).
The fix
When the app's hit-test and the observation agree on an enabled AXMenuItem of an open native menu (
MenuItemPoint.swift), the engine performs the item's AXPick (or its AXPress) by route 1 instead of posting. It does this in every mode and never posts a pointer event.The effect is confirmed from evidence, never from the action's return value:
Without that evidence, the answer is
clickUnconfirmed.The click is refused with
appWindowOverPoint, sending nothing, with the way through in the sentence, when:notRecorded,notHit, orrelabelled;unobserved: menu-bar menus and submenus).Other safeguards:
#452's refusal sentence now names
getAXState()(it saidgetScreenshot). The model-facing docs and the Decision Log are updated.Evidence
docs/evidence/2026-11-20-menu-item-click/README.md. Kitprobe/454-measure, README5c706331. Fix run 44869514420; main runs 44848863214, 44856543463 and 44863373571.Fixed:
<select>: taken 15/15, but answers unconfirmed (macOS engine: a Chrome <select> item delivered by #454 is taken but answers unconfirmed (the selection isn't read) #461).unobserved30/30. Main falsely answered ok, and the screenshot doesn't show these menus.At parity with main:
Cost:
menuItemClick.msp50 is about 420 ms when confirmed and about 1020 ms when unconfirmed.stalePoint.msandhitMsare within 0.2 ms of main at p50.Review: reviewer-high ran three rounds and reviewer-medium one, on the qualification's fix wave. Every finding was fixed, and the review stopped after the last wave.
swift test: 1539 run, 0 failures, 1 skipped. The docs tests pass 28/28.Limits
clickUnconfirmed(45/45), where main answered ok. The selection is unchanged, which is the requested state, but nothing independent shows the item was taken.<select>: it answers unconfirmed (value: "unread"), tracked as macOS engine: a Chrome <select> item delivered by #454 is taken but answers unconfirmed (the selection isn't read) #461.Sminos-Session: cursor235#b93055dd (cua on macbook)