Skip to content

refactor(ui): share composer suggestion menu behavior - #140633

Merged
steipete merged 3 commits into
mainfrom
steipete/dedup-ui-0906
Sep 7, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/dedup-ui-0906

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

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.ts owns listbox/option rendering, bounded scrolling, and navigation. chat-composer-menus.ts owns 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

  • 161/161 focused unit cases pass: 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.
  • 21/21 mocked Gateway Chromium cases pass using node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner with chat-skill-references, chat-slash-command-ranking, chat-flow.composer-shortcuts, chat-composer-focus, and new-session-page.responsive-welcome E2E files.
  • Baseline skill-reference E2E passed before editing; existing regression suites remain intact.
  • Codex autoreview: scoped clean through P2, no accepted/actionable findings.
  • git diff --check passes.
  • CI initially reported one stale architectural inventory in 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 build passes on the updated head (11m 21.4s). pnpm ui:check-performance passes at 348073 B startup JavaScript gzip across 8 requests; the baseline is unchanged. node scripts/check-changed.mjs passed 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.

Menu Before After
Slash Slash menu before Slash menu after
Skill Skill menu before Skill menu after
Mention Mention menu before Mention menu after

Review and CI follow-up

The unrelated compact-shard child-exit failure on c368517faaf24ac455c18d2d491a51ab4c4cc4b5 passed 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 onto 8e3f572ffa25a3c02a732950c74c75c16516d7e7. 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.

Before: the first active argument is above the viewport

After: the first argument is visible when the mode changes

@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 02:10
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 2:30 AM ET / 06:30 UTC.

ClawSweeper review

What this changes

Shares 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
Reviewed head: c0d44f9f2e14de1d0c343f82c4e6e3e3996fdedf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused consolidation with the previous defect repaired, useful regression coverage, and no remaining blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER association exempts this PR from the external-contributor proof gate. Its body reports source-dev-server menu captures and browser verification of the repaired viewport; media were not independently inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER association exempts this PR from the external-contributor proof gate. Its body reports source-dev-server menu captures and browser verification of the repaired viewport; media were not independently inspected.
Evidence reviewed 8 items Previous finding resolved: The slash renderer now uses distinct stable keys for argument and command modes, recreating the viewport when modes change while retaining it within a mode. This directly addresses the finding retained in the supplied previous-review projection.
Behavioral regression coverage: The browser regression exercises overflowing command and argument lists using Enter, Tab, and pointer selection, checks first-option visibility, verifies the return transition resets scrolling, and checks that selection did not send a message. The supplied PR body reports these cases failing before the repair and passing afterward; tests were not executed during this read-only review.
Selection and admission preserved: The complete introduced diff preserves Tab completion versus Enter execution, differing empty-menu consumption, argument pointer focus, mention lookup generations, and host-owned composition gates. The changed boundary is OpenClaw's Lit presentation layer; it does not depend on a Codex runtime contract.
Findings None None.
Security None None.

How this fits together

Control 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -5, Tests +108. Total +103 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 8 432 437 -5
Tests 2 111 3 +108
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 543 440 +103

Review metrics

Metric Value Why it matters
Viewport regression coverage 3 selection methods, both mode transitions The added browser cases directly protect the viewport lifetime that caused the previous blocking finding.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is a behavior-preserving internal UI consolidation with no remaining demonstrated user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER association exempts this PR from the external-contributor proof gate. Its body reports source-dev-server menu captures and browser verification of the repaired viewport; media were not independently inspected.
  • remove P2: Current review triage priority is P3, so this older priority label is no longer current.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is a behavior-preserving internal UI consolidation with no remaining demonstrated user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER association exempts this PR from the external-contributor proof gate. Its body reports source-dev-server menu captures and browser verification of the repaired viewport; media were not independently inspected.

Evidence

What I checked:

Likely related people:

  • Vyctor H. Brzezowski: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-07T02:17:02.750Z sha 50b9056 :: needs changes before merge. :: [P2] Reset the scroll viewport when opening command arguments
  • reviewed 2026-09-07T02:27:15.568Z sha c368517 :: needs changes before merge. :: [P2] Reset the scroll viewport when opening command arguments
  • reviewed 2026-09-07T02:37:00.629Z sha c368517 :: needs changes before merge. :: [P2] Reset the scroll viewport when opening command arguments
  • reviewed 2026-09-07T02:43:21.396Z sha c368517 :: needs changes before merge. :: [P2] Reset the scroll viewport when opening command arguments
  • reviewed 2026-09-07T02:54:46.651Z sha c368517 :: needs changes before merge. :: [P2] Reset the scroll viewport when opening command arguments

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.
@steipete
steipete force-pushed the steipete/dedup-ui-0906 branch from c368517 to c0d44f9 Compare September 7, 2026 06:24
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 7, 2026
@steipete
steipete merged commit caec9c8 into main Sep 7, 2026
143 checks passed
@steipete
steipete deleted the steipete/dedup-ui-0906 branch September 7, 2026 06:41
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant