Skip to content

macOS engine: a coordinate click on a closed pop-up button is delivered as its AXPress, and the person's focused window is put back (#458) - #467

Merged
SSFSKIM merged 25 commits into
mainfrom
fix/458-popup-press
Nov 21, 2026

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Closes #458. Version 0.28.26. Design rulings 977, 979, 992, 1004 and 1005.

The bug

A coordinate click on a closed pop-up button answered ok, but no menu stayed open. The cases: TextEdit's font menu, Script Editor's language menu, Chrome's <select> in dedicated mode, and TextEdit's font-size combo box.

  • In shared mode the menu did open, 110–260 ms in. Then route 3's hold-and-restore, which puts the person's window back on top, closed it.
  • In dedicated mode nothing stayed open.

The fix

  • Delivery. A coordinate click on an enabled, closed AXPopUpButton is carried by the control's own AXPress, in every mode, and nothing is posted. The app's hit-test and the observation must agree on the control. Chrome's closed <select> is recognised by its recorded option at the point. A combo box's arrow is the AXButton child at its trailing edge. The press goes through the element route; the decided press replaces the pointer delivery outright (pressRoute), so no delivery guard runs to close the menu. macOS engine: a left click into a background Chrome page is swallowed as the window's activating click, and cua reports success #282's route for a page behind gets the same checks. The new code is PopUpPoint.swift, plus the glue in Input.swift after macOS engine: a click on a pop-up menu's item (Chrome <select>, TextEdit font menu) answers ok but the item is never taken #454's step.
  • Effect. The click is confirmed when a new window of the app's own opens at the control within 1.5 s: a layer-101 menu, or, for the combo box, a list window above the document with AXExpanded not reading false. Otherwise it answers clickUnconfirmed. A combo box whose arrow has no action is refused with backgroundClickRefused while the app is not frontmost, with the ways through.
  • Restore (1005). Once the open is confirmed, the person's focused window is raised back over the app's window with one AXRaise inside the screen-update hold. That is route 3's existing repair. No other window is raised; they are counted in restored.leftCovered. The restore stops on the person's input. It has a 500 ms cutoff with a timed release of the hold. The focused window is identified only by its AX window number (focusUnknown), the raise's AX result is read (focusRaiseFailed), and the order is read once.
  • Meta popUpClick; the model-facing docs and their byte-equal copies; Decision Log entries.

Evidence

docs/evidence/2026-11-21-closed-popup-press/README.md. Kits probe/458-measure, probe/458-restore and probe/458-qual, README 44a91ee1. Main aebd0eb ran 44936682259. The fix ran 44941888406 for delivery and parity, and 44949635594 on the final restore (e7fc289; the head adds only the evidence commit).

  • Behind, font and language: main opened 0/40. The fix confirmed, opened and took the item 40/40.
  • <select> behind: main 10/20, the fix 20/20.
  • Combo arrow: main 0/20, the fix 20/20.
  • Frontmost: 40/40 on both.
  • False confirmed 0, false unconfirmed 0. Parity was identical, 20/20: a plain button, an open menu's item (macOS engine: a click on a pop-up menu's item (Chrome <select>, TextEdit font menu) answers ok but the item is never taken #454), and the combo's text.
  • Restore on e7fc289, 30 rows per layout: the person's focused window never left F1, transiently or at the end, 0/90, under a key-window watch. F1 was back above the app's window 90/90. Nothing activated. Cover time was at most 100 ms.

Review. reviewer-high ran across five rounds on the delivery and the restore. Each finding was fixed, and the review was closed after the last wave. reviewer-medium on the one-pass restore found 2 P1s and 2 P2s, all fixed. The focused-only change after that only removes code. One finding, the cross-session repair watch, was triaged to tech-debt-tracker.md. swift test: 1579 run, 0 failures, 1 skipped.

Limits

  • The person's other windows stay covered by the app's window after a background open, including a third app's window that was above it. Layout a leaves 1 window covered, 30/30; layout c leaves 3, 30/30. restored.leftCovered reports them.
  • The full-order restore was tried and dropped. It raised each of the person's windows back to front, focused window last. It moved the person's focused window to another window for 13–49 ms: 38/80 behind rows on 67cf8b2 and 13/30 on 2bd74c6. AXRaise also can't lift a third app's window above the active app's. That restore is macOS engine: after a background pop-up opens, put all of the person's covered windows back without a transient key-window change #466.
  • 1.5 s wait. On an unconfirmed answer (a press accepted with no menu), the answer comes about 1.57 s later than main at p50, 1.73 s max.
  • Key-window watch interval. It averaged about 22 ms, not the 5 ms asked for, so a focus change shorter than about 20 ms could go unseen.
  • Not measured: pixels and flashing. The restore always runs inside the screen-update hold.
  • macOS engine: route 3's shared-mode restore closes transient UI the click opened (popovers, tooltips, menus), answering ok #463: route 3's restore probably closes other transient UI the same way. It has its own ticket.
  • Cross-session repair watch: another session's repair watch can close a just-opened menu (a rare race, in tech-debt-tracker.md).

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

…ed as its AXPress and confirmed by its menu opening; a combo box's arrow behind is refused (refs #458)

Design rulings 977 and 979. #458's kit found main's click on a background pop-up opens its menu and route 3's
hold-and-restore closes it (10/10), while the button's AXPress opens it in every mode (30/30 route 3, 30/30 route 1).
After the stale-point guard and #454's step, before anything is posted: when the app's hit-test (in time) answers an
enabled, closed AXPopUpButton (in a web page only Chrome's <select>, with its AXMenu child) that the observation
recorded at the point, the click is its AXPress by the element click's route (focus hold when the app does not
believe it has focus), confirmed only when a new layer-101 window of the app's appears over or next to the button
within 500 ms, else clickUnconfirmed. Nothing after the press puts the window order back (the hold's guard ends
before it; the element route has no delivery guard or after-action watch), so the menu stays open. A native combo
box's arrow (no element action) with the app not frontmost is refused as backgroundClickRefused, nothing sent.
Disagreeing signals, a late or failed hit, a disabled or open button and one with no AXPress keep main's path, said
in the meta (popUpClick.kept); shared mode's web pages behind stay #282's. A confirmed open that raised the app's
window above the person's records the order to restore (ConnectionState.popUpMenuOrders, PopUpMenuOrder), not yet
acted on. recordedMenuItem's search and inWebArea are shared, not forked.

Sminos-Session: cursor235#b93055dd (cua on macbook)
… menu stays open and the restore seam in the Decision Log, and the meta's popUpClick (refs #458)

Sminos-Session: cursor235#b93055dd (cua on macbook)
… its action and is confirmed by its menu opening, and that a combo box's arrow behind is refused, with the ways through (refs #458)

Two sentences after #454's sentences 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 them.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ered as its AXPress, and a combo box's arrow behind is refused (refs #458)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…box's arrow as measured, #282's select press confirmed, the check before the press after the hold, and unread window lists (refs #458)

The review of edbfbd2..75fecad (reviewer-high), against run 44877626226's shapes: (1) a closed <select> has no
AXMenu child (125/125); it is now qualified by its options recorded under it, the deepest recorded node at the point
(hitAboveNode, recorded AXMenuItem, 15/15). (2) The combo box's arrow hit-tests and is recorded as an AXButton child
(15/15); it resolves to its AXComboBox parent, and a hit on the combo box itself (its text) is main's. (3) #282's
element route keeps delivering a shared-mode page's <select>, and its press now gets the same check before it, effect,
clickUnconfirmed answer and order record (popUpConfirmingRoute, via webAreaPress's beforePress). (4) A control whose
parents do not read to its window takes the record's web area, else keeps main's path (ancestryUnread). (5, 7) Just
before the press, after the hold: the deadline again, the button still closed (a menu opened since refuses, nothing
pressed), and the effect's baseline; the decision's list stays the restore seam's order. (6) An unread window list
(onScreenWindowListRead) is no proof: unread at the decision keeps main's path (windowsUnread), unread before the
press answers clickUnconfirmed (baselineUnread), an unread poll is a sample with nothing seen. (8) The pop-up's press
is counted by recordingRouteAdvice; kept decisions are not. Tests rebuilt from the measured shapes.

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

Sminos-Session: cursor235#b93055dd (cua on macbook)
…opUpClick fields (refs #458)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…the pointer's place, #282's press leaves a timeout to the menu, and the option, arrow, baseline and deadline as measured (refs #458)

The re-review of 75fecad..1d70a33 (reviewer-high): (1) a qualifying <select> on #282's route is now the pointer's
pressRoute, which deliverPointer runs instead of any activation or event, so an activation that clicks its in-window
point (Electron's) no longer posts the click behind it; the refusal-only elementRoute stays for every other page click.
(2) #282's press goes through deliverAction with a judgment of non-success errors: on the <select>, a messaging
timeout is left to the observed menu (actionError recorded), anything else and any other control's stays actionFailed.
(3) The option evidence is the measured shape only: the deepest recorded node at the point an AXMenuItem under the
pop-up, the hit above it (hitAboveNode); items recorded off the point are none. (4) A combo box's arrow is its button
child at its trailing edge with no button further right, or with frames unread its only button child; a clear or
accessory button keeps its own click. (5) The baseline holds every window of the list read before the press; only
post-press candidates are filtered by layer and alpha. (6) The deadline is checked after the last read before the
press (AXExpanded, the list), on the unread-baseline path too.

Sminos-Session: cursor235#b93055dd (cua on macbook)
Sminos-Session: cursor235#b93055dd (cua on macbook)
…nd presses the combo box's arrow instead of refusing it (refs #458)

#458's restore kit (probe/458-restore, README f39ce42, run 44888938314): raising every window of the person's that
was in front of the app's before the open, back to front, restores the whole order (180/180, 232 ms worst, nothing
else moved), the menu staying usable (60/60), and only a restore at the open covers a menu left open or closed by the
person's click. So the person's windows in front of the app's window in the list read just before the press (layer 0,
other processes, never the engine's own) are raised back by route 3's own repair (ActivationSystem.raise, AXRaise on
each window's element, never an activation) inside the screen-update hold, as soon as the open is confirmed and the
app's window has risen over any of them (in the confirming list or within 60 ms after it), sampled as route 3's
delivery guard samples (2 ms, 3 stable samples, at least 60 ms), bounded at 500 ms. Meta popUpClick.restored {windows,
ms, complete, raises}; an incomplete restore leaves the open confirmed and adds a note to the answer. The recorded
seam (popUpMenuOrders, PopUpMenuOrder) is gone: nothing else needed it.
The combo box's arrow (TextEdit's "font size" AXButton, AXPress, its trailing edge exactly 4.0 pt inside the box's)
opens the list behind 20/20 as a new layer-0 window of the app's that raises nothing: its AXPress is now delivered and
confirmed by a new window of the app's of any layer at the combo box; only a combo box with no pressable arrow is
refused.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…s confirmed by its list; only a combo box with no pressable arrow is refused (refs #458)

The two #458 sentences 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 the correction.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…he Decision Log, correcting ruling 977's refusal, and the meta's popUpClick fields (refs #458)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…t, an absolute cutoff with a timed hold release, only certain windows raised, a crossing starts it, the combo list on its measured signals (refs #458)

The review of 97344ee..a094f62: (1) a person baseline at the press's dispatch (route 3's own signals: input since,
by secondsSinceInput, and the frontmost app) ends the rise watch and stops the restore before its next raise,
complete false with stopped "personInput" and no note. (2) One cutoff of 500 ms from the restore's start covers the
windows' resolution, every raise (none issued past it) and the hold, whose release a timer of its own makes at the
cutoff (scheduleHoldRelease, OnceRelease). (3) A person's window is raised only when told for certain: its own number
by the SPI (axWindowNumber), else the one unnumbered AXWindow with its bounds while the list holds one such window of
the process; an ambiguous one is never raised and the restore ends complete false ("unresolved"). (4) The restore
starts only when the app's window crossed above a recorded window (appWindowCrossed); the person's windows reordered
among themselves start none; the full order is still what a needed restore checks. (5) A combo box's list counts only
above the app's document window and with the combo box not reading AXExpanded false. (6) The arrow's own AXEnabled
must read true. (7) The bound reached before three stable samples is incomplete.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…meta's restored.stopped (refs #458)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ly, one scan per process inside the cutoff, ends unresolved once the rest is back, and samples 60 ms after resolution (refs #458)

The re-review of a094f62..1612abe: (1) the frame fallback is gone: a window whose number axWindowNumber does not
prove is unresolved and never raised. (2) The lookup (resolveByNumber) is handed the cutoff, scans each process's
AXWindows once, reads only the SPI number, stops at the process's last recorded window, and reads nothing once the
cutoff is spent. (3) The order the restore checks and raises for is the resolved windows'; once they are back, an
unresolved window still out of order ends it as unresolved instead of re-raising until the cutoff. (4) The 500 ms
cutoff counts from the restore's start, the 60 ms sampling minimum from a timestamp taken after resolution.

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

Sminos-Session: cursor235#b93055dd (cua on macbook)
… raised last and third apps' windows skipped, and the menu wait is 1.5 s (refs #458)

Design ruling 1004, from #458's qual (probe/458-qual, README efa3505, fix run 44929018111): the sampling loop's
re-raises (6-11 a row) flipped F1 and F2 for up to a second and the last raise to land changed the person's focused
window (3/40 in layout a dedicated, 11/20 in layout c), and a background third app's window under the active app's
never settled (c 0/20). The restore now raises each recorded window of the person's frontmost app once, back to
front, the person's focused window (route 3's userWindow) last, inside the screen-update hold (its timer at route 3's
300 ms ceiling); skips third apps' windows (restored.skipped); reads the order once about 300 ms after the first raise
and records whether it matches, never re-raising. With the focused window unknown, not among the recorded windows or
not resolved, nothing is raised (focusUnknown, unresolved). The person-input stop before each raise, the absolute
500 ms cutoff and the timed hold release stay. Chrome's <select> opened about 940 ms in 2/20 rows: popUpOpenSettleMs
is 1.5 s.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…) in the Decision Log, and the meta's restored fields (refs #458)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…on stays 0.28.26, #456's recheck applies to #458's pop-up gate too (refs #458)

Conflicts: the plugin version (kept 0.28.26) and tech-debt-tracker.md (#456's entry closed on main, #458's kept).
#458's direct pop-up press builds its stale-point gate with #456's app and window number, so its recheck after the
focus hold applies #452's window rules as #282's route's does.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…e, reads its AX result, numbers the focus by the SPI alone, and reads the order only inside the cutoff (refs #458)

The review of 7e5bb45..67cf8b2: (1) the pass can no longer end on a non-focused raise: the person's input stops it
with nothing more raised (checked before the first raise and before each after it), the cutoff skips the remaining
other windows but still makes the focused window's raise, past it by that one call, and each raise's AX result is
read (failedRaises; the focused one failing ends it as focusRaiseFailed). (2) The focused window is the person's
app's AXFocusedWindow numbered by axWindowNumber alone (focusedWindowNumber), with no same-size fallback; none proven,
nothing raised (focusUnknown). (3) The time left is checked before and after the one order read; past the cutoff the
end is bound, never complete. (4) The person's input is checked before the focus is read and before the early return
on no candidates, so switching apps during the open records personInput with no note.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…e meta's failedRaises and focusRaiseFailed (refs #458)

Sminos-Session: cursor235#b93055dd (cua on macbook)
… once, as route 3's repair does; the other covered windows are counted, never raised (refs #458)

Design ruling 1005, from #458's qual 2 (probe/458-qual, README "#458 qual 2" at 5246652): the back-to-front raise of
the person's other windows moved their app's AXFocusedWindow to F2 or F3 for 13-49 ms in 38/80 behind rows on
67cf8b2 and 13/30 on 2bd74c6, though it always ended on F1. The restore is now route 3's own repair alone: when the
app's window has crossed above the person's focused window (AXFocusedWindow numbered by the SPI alone), that one
window is raised once, inside the screen-update hold, and the order is read once about 300 ms later; complete means
the focused window is back over the app's. No other window is raised; the other recorded windows the app's window
covers are counted as restored.leftCovered (skipped is folded into it). A focused window not covered is not raised;
the list unread raises nothing (orderUnread). Kept: focusUnknown, the input check before the raise, the raise's AX
result (focusRaiseFailed), the cutoff, the timed hold release and the single read. The back-to-front pass, its
full-order predicate and their tests are removed; the incomplete note now speaks of the person's front window.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…der the app's; the full-order restore gets its own ticket (refs #458)

Sminos-Session: cursor235#b93055dd (cua on macbook)
… in the Decision Log, and the meta's restored.leftCovered (refs #458)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…op-up press and the focused-window restore (refs #458)

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

chatgpt-codex-connector Bot commented Nov 21, 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-21T21:42:49.801064Z ce96d41 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.

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 background click on a closed pop-up button (TextEdit, Script Editor, Chrome <select> dedicated) answers ok but no menu opens

1 participant