Repository navigation
Description
Problem
In state S (the target holds window-server key focus but isn't frontmost), activate() exits early, so the click is posted with no activation. After #538's (b) it is guarded for window order, but in an app that isn't active a view that refuses first mouse may drop it, and the engine still answers success. #282's refusal (no usable activation point) doesn't apply, because no activation is planned. This is on main today.
Fix direction
Decide from #538's hosted qualification probe, which reports whether the click is delivered in S. If clicks are dropped and subtype 1/2 is harmless there, take option (a2) from the note: key focus alone doesn't count as focused for pointers, so the ordinary background path, with #282's refusal and #321's hold, applies.
From #538's design note (/Users/new/.local/share/187/design-538.md), ruling 1172.
Update (ruling 1173): #538 refuses in S; a guarded delivery in S is designed here
#538 now refuses shared pointer delivery in S (keyFocusOnly, nothing posted). If #538's hosted probe shows S is common and the refusals are costly, this ticket designs a guarded delivery in S: option (b) from #538's note, done properly. The adversarial review of (b) sets its requirements:
- A witness. If the person's window can't be identified (an AXFocusedWindow read fails), don't post. A guard without a witness reports repairs it never made (Activation.swift:176, :689–705, :954–969).
- A recheck at commit. Revalidate the front and intervention immediately before the events, after any blocking AX setup, and refuse on change. Otherwise the guard protects the app the person just left, or abandons the repair (:636–652, :677–686).
- A baseline. Read the initial order, and repair only a crossing the click caused (as PopUpPoint:659–670 does), never a legitimate pre-existing order such as a key panel already above.
- Scope. Shared pointer delivery only. Leave paste and dedicated mode alone: pasteOperation calls deliver() for the first ⌘V, and a lookup between the pasteboard write and ⌘V lets the person's copy reach the target.
- Qualify S independently. Use front and key readings plus the document window id, not a marker computed by the code under test, and drive the real carriers in tests.
Update: the hosted probe of S (accepted by design)
Run https://github.com/SSFSKIM/cua/actions/runs/45272638524, branch probe/538-s (e9e8da3). Findings are in ~/.local/share/538/probe-s/findings.md on the MacBook, and the scene is scripts/probe-538/ on that branch.
- The scene that makes S: an Electron fixture opens a
type:'panel'window and keys it while TextEdit stays frontmost. S occurred in 16/16 attempts, read independently (front = TextEdit, CPS key focus = fixture). Focusing a normal window instead never gave S (0/16): key focus left the fixture. - With macOS engine: synthesized click on a target that holds key focus without being frontmost: activate() exits early, deliver() posts with no hold or repair, and can raise a window unguarded (main) #538: every pointer in S is refused, with nothing posted and no change in window order. A coordinate click on a pressable button is carried by the element route.
- Without macOS engine: synthesized click on a target that holds key focus without being frontmost: activate() exits early, deliver() posts with no hold or repair, and can raise a window unguarded (main) #538 (main's delivery path): every pointer in S posted unguarded. A main-window click raised it over TextEdit 4/4 and took key focus, and the raise wasn't repaired until a later guarded click.
- Scope of S: the engine's primary window in S is the key panel, so coordinate pointers land in the panel. Main-window pointers in S come only from stale element tokens observed before the panel took key.
- Not measured: the probe didn't test whether a posted click is dropped by a first-mouse-refusing view in S (option (a2)'s question). The scene above is where to measure it.
Activity
SSFSKIM commentedon Nov 23, 2026
Body updated with the probe of S (run 45272638524): the scene, the counts, and the note that in S main-window pointers come only from stale element tokens.