Skip to content

Command palette: early click on an item can dismiss the palette instead of running the action #111

Description

@badcuban

Found while chasing the flaky browser test ChatView.browser.tsx > shows create-folder affordances for missing project paths (fails intermittently in CI, e.g. PR #109 runs; passes most local runs).

An instrumented run captured the actual failure state: after clicking the "Local folder" item in the Sources view, the palette element is unmounted entirely (document.querySelector('[data-testid="command-palette"]') returns null) instead of switching to the path input. The click isn't lost — it dismisses the palette.

Working theory: a click that lands in the first frames after the item renders hits a close-by-default select path before the item's keep-open/submenu wiring is in effect. If so this is reproducible by a fast user, not just tests: open add-project, click "Local folder" quickly, palette closes.

Suggested angle: make submenu-opening items keep-open by construction (derive from the item definition rather than a handler wired later), then the flaky test should stabilize without test-side retries. Note for whoever picks this up: naive test-side re-clicking makes things worse — once the palette is dismissed there is nothing to re-click, and a second click during the transition can toggle state (tried and reverted on the PR #109 branch).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions