Skip to content

fix(files): announce that Enter is held while the @file picker is empty - #7673

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
rnoack1:fix/announce-enter-held-file-picker
Sep 3, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
rnoack1:fix/announce-enter-held-file-picker

Conversation

@rnoack1

@rnoack1 rnoack1 commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Type an @file token into the composer and press Enter. Nothing happens.
Clicking the green send arrow works. The two send affordances disagree, and
nothing on screen says why. This is the @file half of the defect fixed for
$skill in #7668.

The cause is not the swallow. useListKeyboardNav's count === 0 branch does
preventDefault() + stopPropagation() on Enter/Tab at document capture, so
ChatInput's handleKeyDown never sees the key. A mouse click on the arrow is
not a keydown, so it reaches fireComposer() → onSend(). The gate is

const releaseKeysWhenEmpty = query.length >= 2 && debounced === query && !isFetching && (data !== undefined || isError)

That hold is deliberate and this PR keeps it. Releasing Enter while matches
are transiently unknowable would irreversibly send a draft whose @token the
user was still completing — the #5029 trap.

The genuine defect is that the hold is silent, and here it is worse than in
the skill picker: FilePickerMenu had no role="status" on any branch, so
even the pre-existing "Enter sends the message" copy — which the skill picker
does announce — was visual-only.

Why it matters

A user who typed the token correctly presses Enter, gets nothing, and has no way
to learn that the button still works. For a screen-reader user there was no
signal at all, in any state of this menu.

Two states hold Enter without ever having announced it, and the file picker has a
200ms debounce the skill picker does not:

Branch Gate Was
query.length < 2 closed — gate needs length >= 2 mute, unbounded
isFetching closed — gate needs !isFetching mute
settled + released open — Enter sends mute (copy existed)

The < 2 branch is the one that is not time-bounded: the user may consider
the token finished at one character, and the hold then persists indefinitely. It
is included deliberately — "Type 2+ chars" explains why the list is empty and
says nothing about the keyboard, which is an independent fact.

The plain no_matches arm (settled but gate-closed) is left alone: it is only
reachable inside the 200ms debounce window, between two states that now announce,
so rewriting it would add live-region churn for a ≤200ms flash.

What changed

Announce-only, with ONE deliberate rendering change declared below. The
swallow, the release gate and the debounce are untouched.

The rendering change: all three pickers now place an opens-above menu by its
BOTTOM edge
(website/src/lib/pickerMenu.ts, plus the one style line in each
of the three menus). This is not scoped to the announcement and it is not
scoped to this picker, so it is called out here rather than left to a test
comment. Cause: menuGeometry positioned by top = anchorTop - (count * rowH + 8) - 4, trusting a row estimate as the real height, and the portal then grows
DOWNWARD from that top — so whenever the real height exceeds the estimate the
surplus lands on the composer the user is mid-draft in. Measured on the base
tree, before any copy change: a file-picker row's real box is 53px against
the 48px passed in, so a 3-row populated menu overhung by 18px and a
1-row menu by 7px; the wrapping announcement overhung by 7px in English and
25px in German. Pinning the bottom edge makes the estimate's accuracy
irrelevant — it now only chooses which side the menu opens on. extraH keeps
its exact prior meaning, so the skill picker's scope-footer budget is unchanged.
Scoping this to the empty state was considered and rejected: the populated
overhang is real and pre-existing, so a narrower fix would leave it standing.
Placement is pinned by a test for each of the three menus and for a populated
file-picker menu, and the geometry invariant (the bottom offset does not move
with count, rowH or extraH) by a unit test.

  • website/src/components/FilePickerMenu.tsx — the three empty branches collapse
    into one role="status" region with a computed key. One region rather than
    three means it exists from first paint, so every transition is a text change
    inside a live region rather than a mount — the case screen readers announce
    least reliably. That makes the pre-existing settled copy more reliable too.
  • Four new keys, following the existing _enter_sends / _ctrl_enter_sends
    pattern: searching_enter_held, searching_ctrl_enter_held,
    type_2_chars_to_search_files_enter_held, and its _ctrl_enter_held variant.
    The sendOnEnter === 'ctrl-enter' branch is load-bearing: a bare Enter is a
    newline in that mode, so promising "Enter" would be false. (The hook keys on
    e.key === 'Enter' regardless of modifier, so Ctrl+Enter is held there too.)
  • The copy names Escape, not the Send button. The hook swallows Tab as well
    as Enter at document capture (useListKeyboardNav.ts:169-179), so a keyboard
    or screen-reader user cannot reach Send while the picker is open — announcing
    it would name an unreachable remedy to exactly the audience a live region
    serves. The Escape branch runs before that swallow (:158) and the document
    listener is removed on close (:266-268), so Escape-then-send is the path that
    actually works; a seventh test pins that Escape closes where Enter and Tab do
    not. de also moves to the Sie register its base half already uses.
  • Authored in en.manual.json and translated into all 11 catalogs, each reusing
    that catalog's own base string, separator (es a colon, zh-CN ——), key
    spelling (it says Invio) and its existing Esc token. en-XA regenerated
    with npm run i18n:pseudo.
  • searching and type_2_chars_to_search_files are now unreferenced, so they are
    removed from en.json and the 11 catalogs — deadKeys.test.ts is a hard
    ratchet pinned at exactly 29, so leaving them would fail CI at 31. No existing
    test pinned either literal, so unlike fix(skills): announce that Enter is held while the $skill picker loads #7668 no assertions needed rewriting.

SlashCommandMenu.tsx composes onto the structure #7418 landed while this PR
was in flight, rather than replacing it:

  • fix(chat): bound the /-menu slash-command fetch so a slow gateway fails visibly #7418 already renders during an in-flight zero-match and added its own
    isError arm, so this PR's earlier early-return change is dropped as
    redundant
    — its filtered.length > 0 guard covers the one-effect-flush lag
    more directly than the holdingWhileFetching predicate did.
  • What fix(chat): bound the /-menu slash-command fetch so a slow gateway fails visibly #7418 left is the defect: its in-flight arm renders loading_commands in
    a mute div, immediately beside a sibling that does carry role="status".
    That arm now announces the hold via a loadingKey, mirroring the shape fix(skills): announce that Enter is held while the $skill picker loads #7668
    shipped for the skill picker. Its emptyKey, isError arm and
    commands_load_failed_* keys are untouched.
  • Two new keys, loading_commands_enter_held / _ctrl_enter_held, in all 13
    catalogs, each locale's held half sliced from its OWN
    filePickerMenu.searching_*_held. loading_commands is retired: its only
    reference was the line replaced, so leaving it would take deadKeys from 29
    to 30 and fail both assertions in that file.
  • Two of main's assertions matched the exact string 'Loading commands…' —
    SlashCommandMenu.test.tsx would now fail and timeout.test.tsx would
    pass vacuously. Both repaired to /Loading commands…/, the same
    copy-agnostic form main itself uses for the skill picker.

Copy for all three pickers now reads alike, which is what put the skill
picker back in this diff.
UX-Verdict CONCERNS at 644ca4474: main's shipped
$skill menu announced the identical held state as "Enter won't send yet; use
the Send button" while this PR's strings said "Enter is held; press Esc" — one
keyboard state, two vocabularies, and two contradictory remedies. Worse, the
sibling's remedy is a mouse target, unreachable for exactly the screen-reader
audience a live region exists to serve.

All eight *_held strings now read "… — won't send yet; press Esc,
then sends the message": the sibling's reader-language, this PR's
reachable remedy. Each locale composes only fragments that ALREADY shipped and
were already reviewed — clause A from that locale's own skillPickerMenu string,
clause B from its own filePickerMenu string — so no translation is invented and
each locale keeps its own separator, clause delimiter (; / 。 / , / French
spaced ;) and key spelling (it says Invio). #7668's component change, its
keys' shape and its test remain upstream's; this diff changes their two
copy VALUES, the two assertions that pin them, and the one style line that
adopts the bottom placement described under "What changed" — that helper is
shared by all three pickers, so the change reaches this one too. A test here
pins its placement rather than leaving it implied.

Note for reviewers: the keys are spelled as literals in nested ternaries
rather than built by template concatenation. Concatenation type-checks and runs
correctly but is invisible to the dead-key reference scanner — it reported 33.

Evidence

Captured from the real built SPA on the real /chat route, driving the real
composer (harness follows scripts/capture-above-composer-order.mjs); each menu
is the real component rendering the real catalog. Each state is produced by the
gate's own inputs, not by forcing a branch.

Under 2 characters — the fetch never starts, so this hold is unbounded in time:

File picker under two characters, announcing that Enter will not send yet

Search in flight:

File picker while searching, announcing that Enter will not send yet

Settled and genuinely empty — the gate is open, so Enter sends (pre-existing
copy, now inside the same live region):

File picker settled with no matches, announcing that Enter sends

The /command menu's in-flight hold, which previously rendered nothing at all:

Slash command menu while the command list loads, announcing that Enter will not send yet

The long-string locales, where the announcement wraps to a third line — the
case the old row-estimate placement could not budget for. Both clear the
composer by the intended 4px gap:

German three-line announcement clearing the composer

French three-line announcement clearing the composer

Tests

New: website/src/test/FilePickerMenu.heldAnnounce.test.tsx (7 tests) and
website/src/test/SlashCommandMenu.loadingAnnounce.test.tsx (6 tests).

  • Four regression tests — the in-flight state is a live region; its copy names
    Enter as held and Escape as the keyboard way out; the ctrl-enter binding gets
    Ctrl+Enter; and the under-2-character state announces too.
    Proven to fail on an unmodified base: with the source and catalogs stashed
    back to HEAD all four fail with Unable to find role="status", then pass
    again restored.
  • Two negative controls — Enter and Tab are still swallowed, once while a
    search is in flight and once below 2 characters (fireEvent.keyDown returns
    false), and neither onSelect nor onClose fires. Both pass on base and
    fix, so they are visibly not the thing under test; the second is also the
    evidence that the < 2 branch holds the key at all.

For the slash menu: three regression tests (live region, held copy naming Esc,
the ctrl-enter variant), proven to fail on an unmodified base — all fail
with Unable to find role="status", then pass restored. Plus three controls that
pass on base and fix: Enter and Tab still swallowed in flight, Escape still
closes where they do not, and a settled zero-match still promises the send rather
than the hold, pinning that the two arms are not confused. One existing
assertion in SlashCommandMenu.test.tsx asserted the old invisibility
(queryByRole('listbox') absent in flight) and now asserts the announcement; its
swallow assertions are untouched.

Harness note: the picker returns null until anchorRef.current exists, and a
never-settling fetch supplies no re-render of its own, so the harness forces one
after mount. Without it the portal never renders and the assertions fail for the
wrong reason.

Gate, run in a fresh worktree off upstream/main with a real npm ci:

Check Result
npm run test:website 1753 files, 27516 passed, 0 failed
npx tsc -b clean
npm run lint 0 errors; my delta is 0 warnings (see below)
npm run lint:i18n rc=0, at/below baseline
npm run i18n:check rc=0, every catalog at/below its bound
deadKeys.test.ts holds at exactly 29
catalogParity.test.ts 77 passed, en-XA included

npm run test:electron fails with Cannot find module 'electron' —
node_modules/electron is absent in this sandbox. Environmental, and untouchable
by a diff confined to website/src.

Pattern harvest

Rule candidate: lint / semgrep — flag a component that passes
releaseKeysWhenEmpty to useListKeyboardNav and whose empty-state branch
renders without role="status". The hook's count === 0 arm preventDefault()s
Enter and Tab at document capture, so every such branch captures the keyboard;
if it does not also announce what still sends, the capture is silent by
construction. A mechanical check is possible because both halves are local to
one file: the prop at the hook call site and the role on the branch it renders.

Scope of the shape, grepped: exactly three components pass
releaseKeysWhenEmpty — FilePickerMenu, SlashCommandMenu (both fixed here)
and SkillPickerMenu. Other useListKeyboardNav callers (the palette,
ProjectPicker, Settings search) never pass the gate, so they are outside this
shape. All three are now fixed — the file picker and the /-menu here, the
$skill picker by #7668 on main — so the shape has no remaining instance, and
the census that motivates the rule candidate is also its own completion proof.

Base-side note, not a claim about this diff

Frontend Lint & Type Check runs npx eslint src/ --max-warnings 603
(ci.yml:1329). Measured on this branch: the bare upstream tip
7126fa16ba alone reports 604 warnings with my commit absent, and adding my
commit leaves it at 604 — a per-file/per-rule diff attributes the extra one
to website/src/pages/ArtifactsPage.tsx [react-hooks/exhaustive-deps] (2 -> 3),
a file this PR does not touch. Recorded as a measurement for whoever owns the
ratchet; not a request to waive anything.

@rnoack1
rnoack1 requested review from a team and buluoray September 1, 2026 16:29
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 1, 2026
@rnoack1
rnoack1 force-pushed the fix/announce-enter-held-file-picker branch from 1aee055 to 8c87035 Compare September 1, 2026 18:17
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 1, 2026
@rnoack1
rnoack1 force-pushed the fix/announce-enter-held-file-picker branch from 8c87035 to f0ba02d Compare September 1, 2026 22:28
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 1, 2026
@rnoack1
rnoack1 force-pushed the fix/announce-enter-held-file-picker branch from f0ba02d to 0f890bc Compare September 2, 2026 00:33
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 5784a0b22a8def0cec4b83afed0d47573b0d6187 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5784a0b

@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 5784a0b22a8def0cec4b83afed0d47573b0d6187 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

The evidence is complete: temp-screenshots/ is an established repo convention with dozens of precedent directories, the geometry change is centralized in the shared helper all three pickers already use, and every non-trivial hunk (skill-picker copy revision, slash-menu loading arm, bottom-edge placement) is declared in the description with a causal rationale and a pinning test. The bottom-edge pinning is genuinely required by this PR — the wrapping announcement copy is exactly the height the row estimate cannot predict — and the maxHeight: 320 cap plus the bottom-anchored composer bound the new upward-growth direction, so no new failure mode replaces the old overhang. The swallow/release gate itself is untouched and negative-controlled. No phantom claims, no smuggled hunks, no one-way doors.

Design-Verdict: PASS

Announce-only fix at the right layer; the one cross-picker geometry change is causally required, centralized in the shared helper, declared, and pinned by tests.

[DESIGN-REVIEWED] 5784a0b

@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — ✅ PASS

Premise-level review of 5784a0b22a8def0cec4b83afed0d47573b0d6187 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

All lens checks are complete. Every factual claim in the description verified against the trusted base: the count === 0 swallow with the Escape branch before it (useListKeyboardNav.ts:158-179), zero role="status" in the base FilePickerMenu, exactly 3 consumers of releaseKeysWhenEmpty (all three now announce), exactly 3 component consumers of menuGeometry (all three take the new bottom field), the dead-key ratchet pinned at 29, the removed keys referenced only at the replaced lines, and temp-screenshots/ being an established checked-in convention (~200 sibling directories, named in .gitignore as deliverables).

First-Principles-Verdict: PASS

Silent key-capture had three consumers; this fixes all three, and the one rider (bottom-edge placement) is declared, measured, and cause-level.

What this change ships

Intent: tell the user their send key is being held while an empty picker is open — a FIX.

  1. @file picker's under-2-chars state announces the held send key — justified; hold is unbounded there.
  2. @file picker's in-flight state announces it too — justified; this is the reported defect.
  3. @file empty states become one always-mounted role="status" region — justified; base had none on any branch.
  4. /command loading state announces the hold — justified; 3rd of 3 counted releaseKeysWhenEmpty consumers, no siblings left.
  5. Opens-above menus in all 3 pickers pin their bottom edge — rides along, declared; cause-level (estimate 48px vs real 53px), zero option leaves copy overlapping the composer.
  6. $skill held copy: "use the Send button" → "press Esc, then Enter sends" — justified relabel; Send is keyboard-unreachable (Tab swallowed), so old copy named a dead remedy.
  7. Six new keys ×13 catalogs, three dead keys removed — justified; deadKeys ratchet pinned at 29 forces the removal.
  8. MenuGeometry.bottom field — 3 consumers counted, none generalized.
  9. Two string assertions loosened to regex — justified; copy gained a suffix.
  10. Screenshots under temp-screenshots/ — established repo convention, not a rider.

No duplication found: no existing mechanism announces a held key, and the sibling count for the root cause is exhausted within this diff.

[FIRST-PRINCIPLES-REVIEWED] 5784a0b

@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — ✅ PASS

UX-level review of 5784a0b22a8def0cec4b83afed0d47573b0d6187 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

All three pickers now announce the held key identically, the promised remedy (Esc, then Enter) is verified real in the composer's dismissal wiring, and the bottom-pinned menu can no longer cover the draft.

Suggestions

  • FilePickerMenu's rewritten emptyKey ternary still maps a failed search (isError opens the gate at FilePickerMenu.tsx:160) to no_matches_enter_sends — "No matching files" asserts a search that never completed. Mirror the sibling's commands_load_failed_* shape with a search_failed_enter_sends / _ctrl_enter_held pair.

[UX-REVIEWED] 5784a0b

@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed 5784a0b22a8def0cec4b83afed0d47573b0d6187 via the fork AI-review pipeline; updated in place on each push.

Review details

The working tree is the base; these three references are exactly the lines the diff rewrites (FilePickerMenu's empty block and SlashCommandMenu line 254 both replaced with the new emptyKey/loadingKey paths). No surviving reference to a removed key.

My independent review confirms:

  • Geometry: above selection is unchanged; when above, placing by bottom = window.innerHeight - rect.top + 4 pins the bottom edge at rect.top - 4 and grows upward, capped by maxHeight with scroll — strictly away from the composer. Opens-below path ({ top }) untouched. All destructured fields are used (no lint).
  • Copy/a11y: held-copy shown only where the release gate is provably closed (query.length < 2, isFetching), so Enter/Tab are genuinely swallowed and Escape genuinely closes; role="status" correctly makes each empty state a live region.
  • i18n: all 12 languages + en-XA pseudo + en.manual updated; removed keys have no lingering reference.

No candidate to falsify (discovery reported none), and I cannot ground a new finding at the required bar.

No findings.

[OPUS-REVIEWED] 5784a0b

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 2, 2026
@rnoack1
rnoack1 force-pushed the fix/announce-enter-held-file-picker branch from 0f890bc to 5fb7b83 Compare September 2, 2026 03:04
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Sep 2, 2026
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 2, 2026
@rnoack1
rnoack1 force-pushed the fix/announce-enter-held-file-picker branch from 6d8a5db to 7169f2e Compare September 2, 2026 08:06
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 2, 2026
@rnoack1
rnoack1 force-pushed the fix/announce-enter-held-file-picker branch from 7169f2e to 12fb05b Compare September 2, 2026 09:43
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 2, 2026
@rnoack1
rnoack1 force-pushed the fix/announce-enter-held-file-picker branch from 12fb05b to ebc0311 Compare September 2, 2026 12:23
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 2, 2026
@rnoack1
rnoack1 force-pushed the fix/announce-enter-held-file-picker branch from ebc0311 to 10e2bed Compare September 2, 2026 13:55
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 2, 2026
@rnoack1
rnoack1 force-pushed the fix/announce-enter-held-file-picker branch from 10e2bed to ed674cd Compare September 2, 2026 15:02
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Sep 2, 2026
Every empty branch was a mute div while useListKeyboardNav swallowed Enter/Tab,
so the keyboard was captured with no signal at all for a screen-reader user.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on the strength of a full readiness audit of every open PR against main, not a
line-by-line reading of this diff — recording that plainly so the next reader knows what this
stamp does and does not cover.

Verified against this exact head SHA:

  • readiness: passed present, and PR Readiness — the one required status context on main
    (ruleset protected-branches) — is success on this head.
  • No check run on this head is failure, cancelled, timed_out or still in flight. Skipped
    jobs are path-filtered conditionals, none of them required.
  • mergeable: true, and the head is not far enough behind main for its green CI to describe a
    base that no longer exists.
  • No surviving reviewer CHANGES_REQUESTED: any such review is on an older commit and therefore
    already dismissed by dismiss_stale_reviews_on_push.
  • Every issue comment, inline review comment and review thread was read and classified. Nothing
    left is an unresolved human change request — the remainder is bot review-lane output, resolved
    or outdated threads, explicitly non-blocking suggestions, and author status notes.

Auto-merge (squash) is armed, so this lands once every other ruleset requirement is met.

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

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants