Skip to content

fix(web): keep the composer command menu anchored to the composer - #5336

Merged
juliusmarminge merged 1 commit into
pingdotgg:mainfrom
StiensWout:t3code/fix-command-popup-sidebar
Aug 5, 2026
Merged

fix(web): keep the composer command menu anchored to the composer#5336
juliusmarminge merged 1 commit into
pingdotgg:mainfrom
StiensWout:t3code/fix-command-popup-sidebar

Conversation

@StiensWout

@StiensWout StiensWout commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Problem

Type /, @, or $ in the composer, then open the right panel (or the terminal drawer) while the menu is up: the menu stays exactly where it was and detaches from the composer it belongs to.

The menu is portaled to the body and positioned from the anchor's rect, refreshed on window resize, scroll, and a ResizeObserver on the anchor itself. But the composer is centered and capped at max-w-3xl, so on a wide window opening a side panel slides it without ever resizing it. The observer never fires and the menu is left behind.

Measured at a 2200px viewport, menu vs. composer left edge:

before after
right panel opened menu 846, composer 574 menu 576, composer 574
terminal drawer opened menu bottom 536, composer top 404 (overlapping) menu bottom 396, composer top 404

Fix

Observe the anchor's ancestors as well. They are what actually shrink, and they resize on every frame of the panel animation, so the menu tracks the composer through the transition instead of snapping late. Positions are compared before committing to state so the extra observations don't re-render the menu on no-op resizes.

Same layer backs the slash/mention/skill menus and the stash menu, so all of them are fixed.

Composer command menu staying anchored when the right panel opens

Testing

  • Drove the web client in a local dev environment (Playwright, 2200x1200): opened the $ skills menu, then toggled the right panel and the terminal drawer, with and without the patch — numbers above.
  • vp lint and typecheck on the touched scope.

Surfaces

  • Clients: web only. Mobile has its own ComposerCommandPopover with React Native layout and is unaffected; desktop wraps web and inherits the fix.
  • Entry points: all four composer triggers (/, @, $, stash) share this layer.
  • No contract, provider, or docs impact — the behavior was always intended to be anchored.

🤖 Generated with Claude Code


Note

Low Risk
Localized UI positioning fix in ChatComposer with no auth, data, or API changes.

Overview
Fixes composer command menus (/, @, $, stash) drifting away from the composer when the right panel or terminal drawer opens.

The portaled ComposerCommandMenuLayer only watched the anchor for resize; on wide layouts the composer slides when a side panel opens without changing size, so the menu never repositioned. The layer now attaches ResizeObserver to the anchor’s ancestor chain so layout shrinks during panel animation trigger updates.

Position updates are deduplicated via a ComposerCommandMenuPosition type and equality check before setState, so extra observer callbacks don’t re-render on no-op geometry.

Reviewed by Cursor Bugbot for commit 4f68017. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix composer command menu position to track ancestor element resizes

The ComposerCommandMenuLayer in ChatComposer.tsx was only observing the anchor element for resize events, causing the menu to drift when parent containers resized.

  • Extends ResizeObserver to observe the anchor and all its DOM ancestors, so position updates trigger on any ancestor resize.
  • Adds composerCommandMenuPositionsEqual to skip redundant state updates when the computed position is unchanged.

Macroscope summarized 4f68017.

The `/`, `@`, and `$` menus are portaled to the body and positioned from
the anchor's rect, refreshed on window resize, scroll, and a
ResizeObserver on the anchor itself. The composer is centered and capped
at `max-w-3xl`, so opening the right panel or the terminal drawer slides
it without ever resizing it: the observer stays silent and the menu is
left behind, floating next to or on top of the composer it belongs to.

Observe the anchor's ancestors as well. They are what actually shrink,
and they resize on every frame of the panel animation, so the menu
tracks the composer through the transition instead of snapping late.
Positions are compared before committing to state to keep the extra
observations from re-rendering the menu on no-op resizes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4dcb4bc3-1a04-4b8a-8d86-c063cbe34bd7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 4, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 4f68017

Straightforward UI bug fix that ensures the composer command menu stays properly anchored when side panels open. Changes are limited to adding ancestor element observation and optimizing state updates with position comparison.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge
juliusmarminge merged commit 9235c83 into pingdotgg:main Aug 5, 2026
17 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 5, 2026
## What's Changed
* fix(mcp): unblock Kimi models in OpenCode with preview tools by @hwanseoc in pingdotgg/t3code#5128
* fix(web): clear main branch lint warnings by @t3dotgg in pingdotgg/t3code#5384
* fix(mobile): preserve grouped project workspaces by @shivamhwp in pingdotgg/t3code#4642
* fix(mobile): prevent Android thread search crash by @shivamhwp in pingdotgg/t3code#5386
* fix(web): truncate long project switcher names by @FllipEis in pingdotgg/t3code#5348
* fix(mobile): avoid double dividers between thread sections by @shivamhwp in pingdotgg/t3code#5391
* fix(web): keep the composer command menu anchored to the composer by @StiensWout in pingdotgg/t3code#5336
* fix(web): restore terminal link hover styles by @StiensWout in pingdotgg/t3code#5382
* fix(ci): isolate releases from shared API rate limits by @t3dotgg in pingdotgg/t3code#5394


**Full Changelog**: pingdotgg/t3code@v0.0.32-nightly.20260805.1002...v0.0.32-nightly.20260805.1005

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.32-nightly.20260805.1005
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Aug 6, 2026
vortechron pushed a commit to vortechron/void that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants