Correction (2026-10-21, before the PR): this body first presented the race below as the cause of the #19928 arm's e2e-engine flake. The race is real: a held-focus e2e shows it deterministically, red on base and green with the fix. But it is not the arm's only cause. Under the same conditions, the arm still failed 2 of 16 runs at head and 1 of 16 on base, with the same symptom. AC-3 is narrowed accordingly, and the arm's remaining cause is out of scope here.
Context
The #19928 arm in test/playwright/e2e/grid/IssuesShowcase.spec.mjs ("the filter list draws its focus ring inside the row and its rows on the menu surface, in both themes") fails intermittently in e2e-engine (3/4). It failed on the first runs of #19958 and #19960: .neo-navigator-active-item is not found after a pick. @neo-gemini-maryam traced one mechanism (A2A, 2026-10-21): a late search focus that pulls focus off the value just picked.
The Problem
Opening a header menu focuses its search field one worker↔main round trip after the surface shows. Two calls did it: Menu#open() explicitly, and the floating container's own focusOnMount (Component#afterSetMounted pushes focus to the first focusable child). A pointer that picks a value inside that window gets focus first. The late focus then moves it to the search field, and Neo.main.addon.Navigator removes .neo-navigator-active-item on focusout. The pick still applies, but the active state the user just set is gone.
The Architectural Reality
src/grid/header/plugin/Menu.mjs#open(): this.surface.hidden = false; await this.surface.promiseUpdate(); then the search focus. The surface also kept the floating default focusOnMount: true.
src/main/addon/Navigator.mjs adds the active-item class on focusin and removes it on focusout.
- A worker-side guard such as
surface.containsFocus narrows the race but cannot close it, because the user's focusin can still be in flight when promiseUpdate() resolves. The decision belongs on the main thread, at the moment the focus call lands.
- Design authority:
Menu#open()'s own JSDoc, "Opens the same surface from pointer, touch or keyboard". The initial search focus serves an opener that hasn't chosen yet, and it must not override a pointer that already has.
The Fix
DomAccess.focus gains unlessFocusWithin: the id of a container whose current focus wins.
Menu#open() becomes the surface's single focus owner: the surface sets focusOnMount: false, and open() focuses the search input with unlessFocusWithin: surface.id.
- Opening with no intervening pick keeps today's search focus.
Acceptance Criteria
Out of Scope
- The
#19928 arm's remaining flake. Another cause produces the same symptom; my earlier hypothesis is a click that lands before the Navigator's listeners re-bind after the theme switch.
- The same mount-focus race for other floating components (noted separately).
- #19955, #19953 and #19954.
Related
#19928 (the arm) · #19929 · #19958 and #19960 (the flaky runs)
Live latest-open sweep: checked the latest 20 open issues at 2026-10-21T13:41:44Z; no equivalent found. Exact search "Menu open focus search value": none.
A2A sweep: Maryam's root-cause note is FYI with no claim; no other claim on this.
MC sweep: covered by my own handover note on this flake (a lost active-item class was one of its two hypotheses); no prior decision.
Own-assignment sweep: none overlapping (#19955 is the header scroll).
Origin Session ID: 93bb60cd-9a62-43b7-a8e0-25091f9af03f
Retrieval Hint: "header menu late search focus steals focus from picked value, navigator active item focusout, focusOnMount"
Context
The
#19928arm intest/playwright/e2e/grid/IssuesShowcase.spec.mjs("the filter list draws its focus ring inside the row and its rows on the menu surface, in both themes") fails intermittently ine2e-engine (3/4). It failed on the first runs of #19958 and #19960:.neo-navigator-active-itemis not found after a pick. @neo-gemini-maryam traced one mechanism (A2A, 2026-10-21): a late search focus that pulls focus off the value just picked.The Problem
Opening a header menu focuses its search field one worker↔main round trip after the surface shows. Two calls did it:
Menu#open()explicitly, and the floating container's ownfocusOnMount(Component#afterSetMountedpushes focus to the first focusable child). A pointer that picks a value inside that window gets focus first. The late focus then moves it to the search field, andNeo.main.addon.Navigatorremoves.neo-navigator-active-itemonfocusout. The pick still applies, but the active state the user just set is gone.The Architectural Reality
src/grid/header/plugin/Menu.mjs#open():this.surface.hidden = false; await this.surface.promiseUpdate();then the search focus. The surface also kept the floating defaultfocusOnMount: true.src/main/addon/Navigator.mjsadds the active-item class onfocusinand removes it onfocusout.surface.containsFocusnarrows the race but cannot close it, because the user'sfocusincan still be in flight whenpromiseUpdate()resolves. The decision belongs on the main thread, at the moment the focus call lands.Menu#open()'s own JSDoc, "Opens the same surface from pointer, touch or keyboard". The initial search focus serves an opener that hasn't chosen yet, and it must not override a pointer that already has.The Fix
DomAccess.focusgainsunlessFocusWithin: the id of a container whose current focus wins.Menu#open()becomes the surface's single focus owner: the surface setsfocusOnMount: false, andopen()focuses the search input withunlessFocusWithin: surface.id.Acceptance Criteria
Out of Scope
#19928arm's remaining flake. Another cause produces the same symptom; my earlier hypothesis is a click that lands before the Navigator's listeners re-bind after the theme switch.Related
#19928 (the arm) · #19929 · #19958 and #19960 (the flaky runs)
Live latest-open sweep: checked the latest 20 open issues at 2026-10-21T13:41:44Z; no equivalent found. Exact search "Menu open focus search value": none. A2A sweep: Maryam's root-cause note is FYI with no claim; no other claim on this. MC sweep: covered by my own handover note on this flake (a lost active-item class was one of its two hypotheses); no prior decision. Own-assignment sweep: none overlapping (#19955 is the header scroll).
Origin Session ID: 93bb60cd-9a62-43b7-a8e0-25091f9af03f
Retrieval Hint: "header menu late search focus steals focus from picked value, navigator active item focusout, focusOnMount"