Repository navigation
refactor(ui): unify composer menu active-option scrolling - #124256
Conversation
The slash-command and skill-mention composer menus each kept their own byte-identical algorithm for scrolling the keyboard-active option into view inside their ".slash-menu__scroll" viewport. Move that algorithm into the shared chat-composer-dom module as scrollActiveMenuOptionIntoView(activeId), and have each menu owner keep resolving its own active-option id while delegating the scroll math to the shared helper. Fixes #124238
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 5:32 PM ET / 21:32 UTC. ClawSweeper reviewWhat this changesThe branch moves identical active-option scrolling logic from the slash and skill composer menus into their shared composer DOM helper while retaining each menu’s own selection logic. Merge readinessThis PR remains necessary: current main still has the two duplicate scrolling implementations, while the branch consolidates them without changing menu-specific active-ID selection. No blocking patch defect was found; as a maintainer-authored, protected PR, it should wait for maintainer review and the remaining exact-head checks. Priority: P3 Review scores
Verification
How this fits togetherThe Control UI composer handles keyboard navigation in slash-command and skill-mention menus. Each menu resolves its active option, then scrolls the shared nested menu viewport so the active option remains visible without moving the page or composer. flowchart LR
A[Keyboard navigation] --> B[Slash or skill menu]
B --> C[Resolve active option]
C --> D[Shared scroll helper]
D --> E[Nested menu viewport]
E --> F[Visible active option]
Decision needed
Why: The author is a repository member and the PR carries the protected maintainer label, so automated cleanup must not replace a maintainer merge decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource -24. Total -24 across 4 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one composer-local scrolling implementation and land this focused deletion refactor after the exact-head checks and maintainer review complete. Do we have a high-confidence way to reproduce the issue? Not applicable — this PR is a behavior-neutral consolidation, and current source plus existing tests define the preserved keyboard-scroll behavior. Is this the best way to solve the issue? Yes — placing the shared geometry beside existing composer DOM helpers while retaining each menu’s active-ID resolver is the narrowest maintainable shape. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 50df307fab6d. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
scrollActiveSkillMenuOptionIntoView and scrollActiveSlashMenuOptionIntoView only forwarded their state/paneId args to getActive*MenuOptionId and the shared scrollActiveMenuOptionIntoView helper. Delete both wrappers and have the chat-composer.ts keydown call sites resolve the active option id and call the shared geometry helper directly, since both id resolvers were already exported and consumed elsewhere.
|
Merged via squash.
|
…24256) * refactor(ui): unify composer menu active-option scrolling The slash-command and skill-mention composer menus each kept their own byte-identical algorithm for scrolling the keyboard-active option into view inside their ".slash-menu__scroll" viewport. Move that algorithm into the shared chat-composer-dom module as scrollActiveMenuOptionIntoView(activeId), and have each menu owner keep resolving its own active-option id while delegating the scroll math to the shared helper. Fixes openclaw#124238 * refactor(ui): inline forwarding scroll wrappers in composer menus scrollActiveSkillMenuOptionIntoView and scrollActiveSlashMenuOptionIntoView only forwarded their state/paneId args to getActive*MenuOptionId and the shared scrollActiveMenuOptionIntoView helper. Delete both wrappers and have the chat-composer.ts keydown call sites resolve the active option id and call the shared geometry helper directly, since both id resolvers were already exported and consumed elsewhere.
Fixes #124238
What Problem This Solves
The slash-command menu and skill-mention menu each carried a byte-identical
requestAnimationFrame-deferred algorithm for scrolling the keyboard-active option into view inside their shared.slash-menu__scrollviewport (scrollActiveSlashMenuOptionIntoViewinchat-composer-slash-menu.ts:262-286,scrollActiveSkillMenuOptionIntoViewinchat-composer-skill-menu.ts:182-204). They already had to change in lockstep once, when.slash-menu__scrollbecame the shared scroll owner, and the next layout change would require the same duplicated edit or the copies would drift.Why This Change Was Made
scrollActiveMenuOptionIntoView(activeId)inui/src/pages/chat/components/chat-composer-dom.ts, the module that already owns composer DOM/geometry helpers (adjustTextareaHeight,observeTextareaOverflow,replaceComposerPopoverAnchor,restoreHistoryCaret).getActiveSkillMenuOptionId,getActiveSlashMenuOptionId— the latter also branches onslashMenuMode === "args"), preserving the state-specific selection ownership the issue asked to keep separate.scrollActiveSkillMenuOptionIntoView/scrollActiveSlashMenuOptionIntoViewwrappers that only forwarded(state, paneId)to their id resolver and the shared helper. The threehandleComposerMenuKeyDowncall sites inchat-composer.tsnow callscrollActiveMenuOptionIntoView(getActive*MenuOptionId(state, paneId))directly, so the state-specific id resolution and the shared geometry helper compose at the actual call site instead of through an intermediate named wrapper.chat-composer-dom.ts,chat-composer-skill-menu.ts,chat-composer-slash-menu.ts,chat-composer.ts), satisfying the issue's "Production LOC should decrease" requirement more directly than the wrapper-based first cut.User Impact
No behavior change. Keyboard navigation in both menus still scrolls only the
.slash-menu__scrollviewport, never the page or composer, and both menus keep their own selection/focus/keyboard behavior untouched, per the issue's "Do not" list.Evidence
LC_ALL=en_US.UTF-8 node scripts/run-vitest.mjs ui/src/pages/chat/chat-view.test.ts ui/src/pages/chat/chat-composer.test.ts ui/src/pages/chat/chat-composer-context.test.ts ui/src/pages/chat/chat-composer-pointer-activation.test.ts ui/src/pages/chat/chat-composer-queue.test.ts ui/src/pages/chat/chat-composer-capability-host.test.ts ui/src/pages/chat/chat-composer-disabled-banner.test.ts ui/src/pages/chat/components/chat-composer-status.test.ts— 330/330 passed, including the skill-menu scroll coverage inchat-view.test.ts.LC_ALL=en_US.UTF-8 node scripts/run-vitest.mjs ui/src/pages/chat/chat-responsive.browser.test.ts -t scroll— 9/9 passed, covering the slash-menu scroll behavior.node scripts/check-changed.mjs -- <4 changed files>— passed (typecheck, lint, import boundaries, dead-export scan)..claude/skills/autoreview/scripts/autoreview --mode uncommitted— clean: "no accepted/actionable findings reported", overall correctness 0.99.oxfmtcould not run locally in this worktree (no installednode_modules); CI'scheck-lint/format gate is the formatting proof for this push.CI: checks-ui-e2e (6/12)
This shard failed on
ui/src/e2e/agent-file-lifecycle.e2e.test.ts > ... reads and saves the selected agent workspace through an isolated Gateway, asserting the saved file content is# Saved through real Gateway\nbut observing# Real main instructions\n# Saved thr…— a stale/bled file-content assertion in a completely different subsystem (agent workspace file save through a real Gateway) that this PR's diff never touches.This is a shared CI flake, not a regression from this diff:
session-management.sidebar.e2e.test.ts) with a similar "Matcher did not succeed in time" pattern.lobster-pet-dismiss-menu-overflow.e2e.test.ts).Multiple unrelated PRs are failing
checks-ui-e2eat different shard numbers on different tests around the same time, which is the signature of matrix-level flakiness (timing/resource contention in the mocked/real-Gateway E2E lane) rather than something introduced by this branch. This PR's diff is scoped tochat-composer-dom.ts,chat-composer-skill-menu.ts,chat-composer-slash-menu.ts, andchat-composer.ts— none of which touch agent file lifecycle, Gateway file writes, or session management.