Repository navigation
fix(files): announce that Enter is held while the @file picker is empty - #7673
Conversation
1aee055 to
8c87035
Compare
8c87035 to
f0ba02d
Compare
f0ba02d to
0f890bc
Compare
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of The evidence is complete: 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 |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of All lens checks are complete. Every factual claim in the description verified against the trusted base: the 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 shipsIntent: tell the user their send key is being held while an empty picker is open — a FIX.
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 |
UX Review (Fable 5, fork) — ✅ PASSUX-level review of 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
[UX-REVIEWED] 5784a0b |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsThe working tree is the base; these three references are exactly the lines the diff rewrites (FilePickerMenu's My independent review confirms:
No candidate to falsify (discovery reported none), and I cannot ground a new finding at the required bar. No findings. [OPUS-REVIEWED] 5784a0b |
0f890bc to
5fb7b83
Compare
6d8a5db to
7169f2e
Compare
7169f2e to
12fb05b
Compare
12fb05b to
ebc0311
Compare
ebc0311 to
10e2bed
Compare
10e2bed to
ed674cd
Compare
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
left a comment
There was a problem hiding this comment.
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: passedpresent, andPR Readiness— the one required status context onmain
(rulesetprotected-branches) — issuccesson this head.- No check run on this head is
failure,cancelled,timed_outor still in flight. Skipped
jobs are path-filtered conditionals, none of them required. mergeable: true, and the head is not far enough behindmainfor 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 bydismiss_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.
Problem / Motivation
Type an
@filetoken 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
@filehalf of the defect fixed for$skillin #7668.The cause is not the swallow.
useListKeyboardNav'scount === 0branch doespreventDefault()+stopPropagation()on Enter/Tab at document capture, soChatInput'shandleKeyDownnever sees the key. A mouse click on the arrow isnot a keydown, so it reaches
fireComposer()→onSend(). The gate isThat hold is deliberate and this PR keeps it. Releasing Enter while matches
are transiently unknowable would irreversibly send a draft whose
@tokentheuser 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:
FilePickerMenuhad norole="status"on any branch, soeven 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:
query.length < 2length >= 2isFetching!isFetchingThe
< 2branch is the one that is not time-bounded: the user may considerthe 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_matchesarm (settled but gate-closed) is left alone: it is onlyreachable 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 eachof 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:
menuGeometrypositioned bytop = anchorTop - (count * rowH + 8) - 4, trusting a row estimate as the real height, and the portal then growsDOWNWARD 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.
extraHkeepsits 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,rowHorextraH) by a unit test.website/src/components/FilePickerMenu.tsx— the three empty branches collapseinto one
role="status"region with a computed key. One region rather thanthree 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.
_enter_sends/_ctrl_enter_sendspattern:
searching_enter_held,searching_ctrl_enter_held,type_2_chars_to_search_files_enter_held, and its_ctrl_enter_heldvariant.The
sendOnEnter === 'ctrl-enter'branch is load-bearing: a bare Enter is anewline 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.)as Enter at document capture (
useListKeyboardNav.ts:169-179), so a keyboardor 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 documentlistener is removed on close (
:266-268), so Escape-then-send is the path thatactually works; a seventh test pins that Escape closes where Enter and Tab do
not.
dealso moves to the Sie register its base half already uses.en.manual.jsonand translated into all 11 catalogs, each reusingthat catalog's own base string, separator (
esa colon,zh-CN——), keyspelling (
itsaysInvio) and its existingEsctoken.en-XAregeneratedwith
npm run i18n:pseudo.searchingandtype_2_chars_to_search_filesare now unreferenced, so they areremoved from
en.jsonand the 11 catalogs —deadKeys.test.tsis a hardratchet 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.tsxcomposes onto the structure #7418 landed while this PRwas in flight, rather than replacing it:
isErrorarm, so this PR's earlier early-return change is dropped asredundant — its
filtered.length > 0guard covers the one-effect-flush lagmore directly than the
holdingWhileFetchingpredicate did.loading_commandsina 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 #7668shipped for the skill picker. Its
emptyKey,isErrorarm andcommands_load_failed_*keys are untouched.loading_commands_enter_held/_ctrl_enter_held, in all 13catalogs, each locale's held half sliced from its OWN
filePickerMenu.searching_*_held.loading_commandsis retired: its onlyreference was the line replaced, so leaving it would take
deadKeysfrom 29to 30 and fail both assertions in that file.
'Loading commands…'—SlashCommandMenu.test.tsxwould now fail andtimeout.test.tsxwouldpass vacuously. Both repaired to
/Loading commands…/, the samecopy-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$skillmenu announced the identical held state as "Enter won't send yet; usethe 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
*_heldstrings 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
skillPickerMenustring,clause B from its own
filePickerMenustring — so no translation is invented andeach locale keeps its own separator, clause delimiter (
;/。/,/ Frenchspaced
;) and key spelling (itsaysInvio). #7668's component change, itskeys' 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
/chatroute, driving the realcomposer (harness follows
scripts/capture-above-composer-order.mjs); each menuis 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:
Search in flight:
Settled and genuinely empty — the gate is open, so Enter sends (pre-existing
copy, now inside the same live region):
The
/commandmenu's in-flight hold, which previously rendered nothing at all: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:
Tests
New:
website/src/test/FilePickerMenu.heldAnnounce.test.tsx(7 tests) andwebsite/src/test/SlashCommandMenu.loadingAnnounce.test.tsx(6 tests).Enter as held and Escape as the keyboard way out; the
ctrl-enterbinding getsCtrl+Enter; and the under-2-character state announces too.
Proven to fail on an unmodified base: with the source and catalogs stashed
back to
HEADall four fail withUnable to find role="status", then passagain restored.
search is in flight and once below 2 characters (
fireEvent.keyDownreturnsfalse), and neitheronSelectnoronClosefires. Both pass on base andfix, so they are visibly not the thing under test; the second is also the
evidence that the
< 2branch holds the key at all.For the slash menu: three regression tests (live region, held copy naming Esc,
the
ctrl-entervariant), proven to fail on an unmodified base — all failwith
Unable to find role="status", then pass restored. Plus three controls thatpass 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.tsxasserted the old invisibility(
queryByRole('listbox')absent in flight) and now asserts the announcement; itsswallow assertions are untouched.
Harness note: the picker returns
nulluntilanchorRef.currentexists, and anever-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/mainwith a realnpm ci:npm run test:websitenpx tsc -bnpm run lintnpm run lint:i18nnpm run i18n:checkdeadKeys.test.tscatalogParity.test.tsen-XAincludednpm run test:electronfails withCannot find module 'electron'—node_modules/electronis absent in this sandbox. Environmental, and untouchableby a diff confined to
website/src.Pattern harvest
Rule candidate: lint / semgrep — flag a component that passes
releaseKeysWhenEmptytouseListKeyboardNavand whose empty-state branchrenders without
role="status". The hook'scount === 0armpreventDefault()sEnter 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
roleon the branch it renders.Scope of the shape, grepped: exactly three components pass
releaseKeysWhenEmpty—FilePickerMenu,SlashCommandMenu(both fixed here)and
SkillPickerMenu. OtheruseListKeyboardNavcallers (the palette,ProjectPicker, Settings search) never pass the gate, so they are outside thisshape. All three are now fixed — the file picker and the
/-menu here, the$skillpicker by #7668 on main — so the shape has no remaining instance, andthe census that motivates the rule candidate is also its own completion proof.
Base-side note, not a claim about this diff
Frontend Lint & Type Checkrunsnpx eslint src/ --max-warnings 603(
ci.yml:1329). Measured on this branch: the bare upstream tip7126fa16baalone reports 604 warnings with my commit absent, and adding mycommit 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.