Repository navigation
refactor(ui): share composer suggestion menu behavior - #140633
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 2:30 AM ET / 06:30 UTC. ClawSweeper reviewWhat this changesShares suggestion-menu rendering, keyboard navigation, scrolling, and accessibility state between Chat and New Session while preserving their existing selection behavior. Merge readiness✅ Ready for maintainer review The previous viewport finding is resolved, and no remaining actionable defect was found. This maintainer-requested consolidation remains distinct from the related editor and focus work and is not implemented on the inspected main. Priority: P3 Review scores
Verification
How this fits togetherControl UI composers turn typed text and Gateway command or people suggestions into selectable menus. Menu selections update the draft or invoke the existing host-owned command path. flowchart TD
A[Chat and New Session input] --> B[Existing suggestion owners]
C[Commands, skills, and people] --> B
B --> D[Shared menu rendering and navigation]
D --> E[Accessible active option]
D --> F[Host selection handler]
F --> G[Updated draft or command execution]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -5, Tests +108. Total +103 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one shared menu presentation owner, with mode-specific viewport lifetimes and parsing, admission, and command execution retained by their existing owners. Do we have a high-confidence way to reproduce the issue? Not applicable to the consolidation itself. The previous viewport defect has a concrete overflowing-list browser regression and a matching source repair; this review did not execute it. Is this the best way to solve the issue? Yes. The extraction removes duplicated presentation and navigation while preserving existing selection policies, and separate mode keys restore the original viewport lifecycle. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d8af30411265. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Keep parser generations, composer gates, focus behavior, and Enter versus Tab actions with their current owners. Share listbox rendering, navigation, and accessibility projection. Production delta: -13 lines. Proof: 161 focused composer tests and 18 mocked Gateway browser cases pass; inspected before/after menu captures. Codex autoreview clean through P2.
Replace the three migrated owners with their shared renderer in the custom-combobox architectural inventory. The permitted surface shrinks from seven owners to five. Proof: ownership suite reproduced the CI failure (1 failed, 2 passed), then passed 3/3. Codex autoreview clean through P2.
Preserve separate command and argument viewport lifetimes with stable Lit keys. Overflow regressions fail before and pass after for Enter, Tab, and pointer selection; 161 unit cases, 21 mocked browser cases, and changed checks pass.
c368517 to
c0d44f9
Compare
|
Merged via squash.
|
* refactor(ui): share composer suggestion menu behavior Keep parser generations, composer gates, focus behavior, and Enter versus Tab actions with their current owners. Share listbox rendering, navigation, and accessibility projection. Production delta: -13 lines. Proof: 161 focused composer tests and 18 mocked Gateway browser cases pass; inspected before/after menu captures. Codex autoreview clean through P2. * test(ui): track the shared composer listbox owner Replace the three migrated owners with their shared renderer in the custom-combobox architectural inventory. The permitted surface shrinks from seven owners to five. Proof: ownership suite reproduced the CI failure (1 failed, 2 passed), then passed 3/3. Codex autoreview clean through P2. * fix(ui): reset slash menu viewport when modes change Preserve separate command and argument viewport lifetimes with stable Lit keys. Overflow regressions fail before and pass after for Enter, Tab, and pointer selection; 161 unit cases, 21 mocked browser cases, and changed checks pass.
Related: #133011, #138274
What Problem This Solves
The Chat and New Session suggestion menus maintain the same listbox, option interaction, and keyboard navigation in three places. This maintainer-requested consolidation gives slash commands, skill references, and people mentions one presentation owner so future interaction repairs apply consistently.
Why This Change Was Made
ui/src/components/composer-menu.tsowns listbox/option rendering, bounded scrolling, and navigation.chat-composer-menus.tsowns the active-menu accessibility projection for both composers. The adjacent duplicated slash selection paths now share their common operations while preserving Tab completion and Enter execution. Stable command/argument keys preserve the separate viewport lifetimes, resetting scroll when the mode changes and retaining it within a mode.Parsers, asynchronous lookups and refresh generations, loading/empty states, mention payloads, and composer admission remain with their current owners. Existing differences in empty-menu key handling, argument-option pointer focus, and mention scrolling are preserved. The production change is +432/-437 (net -5); the survey's larger estimate did not survive preserving those policies and keeping the editor separate.
Both sibling diffs were inspected. #133011 remains the appropriate home for shared textarea/editor behavior and New Session menu placement; this change stays beneath that work and can be rebased with it. #138274's dead-key focus owner is untouched. Neither sibling PR was modified.
User Impact
No intended behavior or appearance change. Enter versus Tab, IME handling, focus/caret retention, menu ordering, and both composers' gates remain unchanged. No public exports, configuration, wire contracts, or persistent state change.
Evidence
node scripts/run-vitest.mjs ui/src/pages/chat/chat-composer-actions.test.ts ui/src/pages/chat/chat-composer-mentions.test.ts ui/src/pages/chat/chat-composer.test.ts ui/src/pages/new-session/composer.test.ts.node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runnerwithchat-skill-references,chat-slash-command-ranking,chat-flow.composer-shortcuts,chat-composer-focus, andnew-session-page.responsive-welcomeE2E files.git diff --checkpasses.checks-ui (2/3)(5,647 other tests passed). It reproduced locally (1 failed, 2 passed); replacing the three old owners with the shared renderer shrinks the permitted inventory from seven to five, and all 3 cases now pass. A second full-diff Codex autoreview is clean through P2. No runtime changes were needed for that correction.pnpm buildpasses on the updated head (11m 21.4s).pnpm ui:check-performancepasses at 348073 B startup JavaScript gzip across 8 requests; the baseline is unchanged.node scripts/check-changed.mjspassed before the mechanical rebase; the inventory guard and all 21 mocked Gateway E2E cases passed again afterward. Exact-head CI is green.Screenshots below were captured from a source dev server with a synthetic mocked Gateway and inspected in full before upload. Alice, Bob, and the Review skill are fixtures. There is no real Gateway or private desktop content.
Review and CI follow-up
The unrelated compact-shard child-exit failure on
c368517faaf24ac455c18d2d491a51ab4c4cc4b5passed the single maintainer-authorized failed-job rerun: attempt 1, successful attempt 2. No CLI code or timeout changed, and no second rerun was requested.The substantive review finding was reproduced and repaired before landing. Reusing the outer Lit template retained scroll between command and argument modes; the first active argument could be above the viewport. Stable keys at the slash renderer restore the original separate lifetimes in both directions. Three overflowing-list browser cases for Enter, Tab, and pointer selection fail before the repair and pass afterward. Pointer hover activation matches the original implementation. All 161 focused composer cases and all 21 mocked Gateway E2E cases pass; the fresh full-diff review is clean through P2.
The additional images show the same synthetic overflowing argument menu before and after the repair. Before: scrollTop 539 and active choice-00 above the viewport. After: scrollTop 0 and choice-00 visible. Both full captures were inspected; they contain no private data or real Gateway state.
Updated head:
c0d44f9f2e14de1d0c343f82c4e6e3e3996fdedf, rebased onto8e3f572ffa25a3c02a732950c74c75c16516d7e7. The production code and browser regression are byte-identical to the reviewed candidate; main's synchronous inventory helper is retained. Full build and fresh exact-head CI passed. Final startup JavaScript is 348073 B gzip in 8 requests, without a baseline edit. Native review artifacts and the completed ClawSweeper review record the viewport finding as resolved.