Skip to content

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

Done

Description

@SSFSKIM

Problem (on main)

A synthesized element click (route 3) whose target holds window-server key focus but is not frontmost bypasses #200's delivery guard:

  • FakeActivation.activate() treats the process as already focused (believesItHasFocus is frontmost == pid || keyFocus == pid) and returns before it plans an activation or tests PointerRefused;
  • activated stays false;
  • FakeActivation.deliver() then posts the mouse-down and mouse-up directly, with no hold, no order repair and no after-action watch.

If that mouse-down orders the target's window forward, it stays over the window the person is using. This applies today to any synthesized click: a strict-descendant hit, coordinate clicks that take route 3, and, after #258, nothing new, because #258's foreground-only gate rechecks frontmost before posting (ruling 1171).

Found by #258's reviews (reviewer-high, P1 on 31bc458's background path). InputTests.testTheTwoShortExits models the frontmost/key-focus split.

Why it blocks the flip

The flip (#506) makes cua's engine the default for everyone, and an unguarded raise over the user's window breaks #200's promise (ruling 1171).

Fix direction (design first, ruling 1171)

It touches #200's delivery logic, so the design goes to the design session before it is built. Options to weigh:

  • treat key-focus-only as not focused for delivery, so the guard runs;
  • or let the early exit keep its no-activation path but still post under the hold and order repair.

Tests: the key-focus-only split, a strict-descendant synthesized click, and a coordinate click. Each must either go through the guarded delivery or refuse with nothing posted.

Activity

  1. added
    bug
    status:ready-for-architect
    priority:P1
    on Nov 23, 2026
  2. added
    status:in-design
    and removed
    status:ready-for-architect
    on Nov 23, 2026
  3. SSFSKIM commented on Nov 23, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-design: design note in progress (to design session before build, ruling 1171)

  4. added
    status:in-progress
    and removed
    status:in-design
    on Nov 23, 2026
  5. SSFSKIM commented on Nov 23, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-progress: ruling 1173: option (c), refuse shared pointer delivery in S (keyFocusOnly), recheck after deliver()'s lookups

  6. added
    status:in-review
    and removed
    status:in-progress
    on Nov 23, 2026
  7. SSFSKIM commented on Nov 23, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-review: PR #547; rule (c) per 1173/1174; re-review clean at 831bfd3

  8. SSFSKIM commented on Nov 23, 2026

    @SSFSKIM
    OwnerAuthor

    [review-trail] reviewer-high a74a2969: 6baf3e3..dfd9303 -> 1 P1 + 3 P2 + 1 P3 (ruling 1174 fix round); re-review dfd9303..831bfd3 -> correct, no findings

  9. added 3 commits that reference this issue on Nov 23, 2026
  10. SSFSKIM commented on Nov 23, 2026

    @SSFSKIM
    OwnerAuthor

    Hosted probe of S (not of record, accepted by design): https://github.com/SSFSKIM/cua/actions/runs/45272638524 on probe/538-s e9e8da3; findings ~/.local/share/538/probe-s/findings.md (MacBook). S occurred 16/16. With the fix: every pointer in S refused, nothing posted, window order unchanged. On main's path: every pointer posted unguarded, and a main-window click raised it over TextEdit 4/4, unrepaired. With the fixture frontmost, everything posted on both lanes, and the guarded background path was unchanged.

  11. removed
    status:in-review
    on Nov 23, 2026
  12. SSFSKIM commented on Nov 23, 2026

    @SSFSKIM
    OwnerAuthor

    [board] done: Landed via PR #547 (cua 0.29.15)

  13. SSFSKIM commented on Nov 23, 2026

    @SSFSKIM
    OwnerAuthor

    [board] done: merged #547 at 093c91e (0.29.15)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:P1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions