Skip to content

refactor(ui): unify composer menu active-option scrolling - #124256

Merged
vyctorbrzezowski merged 2 commits into
mainfrom
brzezowski/composer-menu-scroll-unify
Aug 15, 2026
Merged

vyctorbrzezowski merged 2 commits into
mainfrom
brzezowski/composer-menu-scroll-unify

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Aug 15, 2026 •

Copy link
Copy Markdown
Member

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__scroll viewport (scrollActiveSlashMenuOptionIntoView in chat-composer-slash-menu.ts:262-286, scrollActiveSkillMenuOptionIntoView in chat-composer-skill-menu.ts:182-204). They already had to change in lockstep once, when .slash-menu__scroll became 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

  • Extracted the shared geometry into scrollActiveMenuOptionIntoView(activeId) in ui/src/pages/chat/components/chat-composer-dom.ts, the module that already owns composer DOM/geometry helpers (adjustTextareaHeight, observeTextareaOverflow, replaceComposerPopoverAnchor, restoreHistoryCaret).
  • Each menu module keeps resolving its own active-option id (getActiveSkillMenuOptionId, getActiveSlashMenuOptionId — the latter also branches on slashMenuMode === "args"), preserving the state-specific selection ownership the issue asked to keep separate.
  • Per review feedback on the first commit, removed the two thin scrollActiveSkillMenuOptionIntoView / scrollActiveSlashMenuOptionIntoView wrappers that only forwarded (state, paneId) to their id resolver and the shared helper. The three handleComposerMenuKeyDown call sites in chat-composer.ts now call scrollActiveMenuOptionIntoView(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.
  • Net production LOC across the branch is -24 (31 added / 55 removed across 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__scroll viewport, 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 in chat-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.
  • oxfmt could not run locally in this worktree (no installed node_modules); CI's check-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\n but 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:

Multiple unrelated PRs are failing checks-ui-e2e at 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 to chat-composer-dom.ts, chat-composer-skill-menu.ts, chat-composer-slash-menu.ts, and chat-composer.ts — none of which touch agent file lifecycle, Gateway file writes, or session management.

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
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Aug 15, 2026
@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review August 15, 2026 19:31
@vyctorbrzezowski vyctorbrzezowski self-assigned this Aug 15, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 5:32 PM ET / 21:32 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 2 items remain

This 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
Reviewed head: c3ca81c7142bbda74956885569fe52bf40d219b1
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving refactor with existing cross-menu coverage and no concrete patch defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository member; the external-contributor proof gate does not apply, while the supplied focused tests remain supporting evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository member; the external-contributor proof gate does not apply, while the supplied focused tests remain supporting evidence.
Evidence reviewed 6 items Current main still duplicates the behavior: Current main contains equivalent request-animation-frame scrolling bodies in both menu owners; the shared DOM helper does not yet exist.
Caller preserves menu-owned selection: The keyboard handler updates the active index, requests a render, and then invokes the scroll callback; the branch substitutes the same existing active-ID resolvers at all three call sites.
Existing behavior coverage spans both menus: The skill test verifies nested-viewport scrolling after keyboard navigation, while the slash browser test verifies visibility, textarea focus, and nested scroll position.
Findings None None.
Security None None.

How this fits together

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

Decision needed

Question Recommendation
Should this maintainer-owned, behavior-neutral composer cleanup be accepted once its exact-head checks finish? Accept after checks: Merge the focused consolidation if the remaining exact-head checks pass, since it preserves menu-specific ID resolution and existing behavior coverage.

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

  • Resolve merge risk (P1) - Several exact-head checks were still in progress at review time; merge only after the required checks complete successfully.
Agent review details

Security

None.

PR surface

Source -24. Total -24 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 4 31 55 -24
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 31 55 -24

Review metrics

Metric Value Why it matters
Production versus test LOC production -24, tests 0 The branch removes duplicated production logic without expanding the test surface; existing slash and skill behavior tests remain the relevant coverage.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #124238
Summary: This PR explicitly implements the canonical duplicate-scroll cleanup requested by the linked issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one composer-local scrolling implementation and land this focused deletion refactor after the exact-head checks and maintainer review complete.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

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

Labels

Label justifications:

  • P3: This is a behavior-neutral UI maintainability cleanup with limited blast radius.
  • 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 author is a repository member; the external-contributor proof gate does not apply, while the supplied focused tests remain supporting evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Local blame reaches commit 3109bc3 at the shallow-history boundary for the existing source, but its unrelated subject prevents a stronger feature-ownership attribution. (role: shallow current-main history boundary author; confidence: low; commits: 3109bc3b5d15; files: ui/src/pages/chat/components/chat-composer-skill-menu.ts, ui/src/pages/chat/components/chat-composer-slash-menu.ts, ui/src/pages/chat/components/chat-composer.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the remaining exact-head checks finish before merge.

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 (1 earlier review cycle)
  • reviewed 2026-08-15T20:08:23.231Z sha 0e46e27 :: needs maintainer review before merge. :: none

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.
@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. and removed P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 15, 2026
@vyctorbrzezowski
vyctorbrzezowski merged commit 4be9091 into main Aug 15, 2026
181 of 183 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the brzezowski/composer-menu-scroll-unify branch August 15, 2026 21:57
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
…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.
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: S 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.

Unify slash and skill menu active-option scrolling

1 participant