LearnNewsExamplesServices
Frontmatter
id18893
titleA menu button drops a click that lands before its lazily loaded menu exists
stateClosed
labels
bugai
assigneesneo-opus-grace
createdAtSep 18, 2026, 4:22 PM
updatedAtSep 18, 2026, 5:21 PM
githubUrlhttps://github.com/neomjs/neo/issues/18893
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 18, 2026, 5:21 PM

A menu button drops a click that lands before its lazily loaded menu exists

neo-opus-grace
neo-opus-grace commented on Sep 18, 2026, 4:22 PM

Context

@neo-opus-ada's defect-note (2026-09-18): component/button/Base.spec.mjs failed in CI three times this afternoon, on three arms, in PRs that touch no menu or button code. The runs were PR #18857 (run 35350078494, attempts 1 and 2) and PR #18873 (run 35345435248). All three stopped at the first poll after createSubMenuButton() + focus() + Enter, which expects focus on Open and got null. Locally they passed 189/189 on an idle machine.

I reproduced it locally under machine-wide load, with the component suite running on 10 workers in the background. At the moment of failure no menu is mounted and focus is still on the button: the Enter never opened anything.

The Problem

button.Base#afterSetMenu() creates menuList inside import('../menu/List.mjs').then(…). onClick() calls toggleMenu(), which reads menuList.hidden with no guard. A click that lands before the import resolves throws in the App Worker and is lost, and the menu never opens. That includes Enter or Space, which a native button turns into a click.

Deterministic reproduction: hold the src/menu/List.mjs fetch, click the button, then release. No menu opens (0 .neo-menu-list).

The arms caught it only under load. A user hits it on a slow device, or by clicking a button as soon as it renders.

The Architectural Reality

  • src/button/Base.mjs: afterSetMenu() (the lazy import), onClick(), toggleMenu() (menuList.hidden unguarded). Every other menuList read in the class is guarded.
  • core.Base#trap() is the destroy-safe way for an instance to await a promise.

The Fix

afterSetMenu() keeps its import promise, and toggleMenu() awaits it through trap() before toggling. A click that arrives early opens the menu once the menu exists, instead of throwing.

Acceptance Criteria

  • A component arm holds the menu/List.mjs fetch, clicks the button, then releases: the menu opens. It is red on dev, where no menu opens.
  • The button arms in the defect-note pass under the load that reproduced them.

Out of Scope

  • A menu config changed at runtime creates another menuList without destroying the previous one.

Related

#18860 (the arms that caught it) · PR #18857 · PR #18873

Decision Record impact: none.

Sweeps: latest open issues and an all-state search for toggleMenu / menuList found nothing equivalent (the nearest is the closed #4868, about focus on a second show). A2A: @neo-opus-ada's defect-note is the source, and there is no claim. Own assignments: none overlapping.

Origin Session ID: 0a997d38-ccdb-4352-ac21-566606a6ab2d

Retrieval Hint: "button menu first click lost lazy import menu/List toggleMenu menuList undefined"