Skip to content

fix(composer): shed control-row chips in priority order at narrow widths (#2189) - #2191

Open
jacktrnr wants to merge 2 commits into
mainfrom
fix/2189-composer-row
Open

jacktrnr wants to merge 2 commits into
mainfrom
fix/2189-composer-row

Conversation

@jacktrnr

Copy link
Copy Markdown
Contributor

Closes #2189

Problem

The composer's bottom control row (add, agent, model, variant, harness, concise, Send) neither wrapped nor shed controls. At narrow chat widths the chips overflowed the flexible control group and painted over the concise toggle and Send. Only the concise toggle had a container-query rule. The root cause sits one level deeper than the issue's file pointers: each chip's trigger is wrapped in TooltipV2's div[data-component="tooltip-v2-trigger"] (display: flex). That wrapper is the row's actual flex item, so its automatic min-width pinned every chip at full label width, even the model button that already had min-w-0.

Approach (the smallest robust one)

CSS only, on the existing amicode-composer container. I didn't add a wrap or an overflow menu.

  1. Send can never be overlapped. The control group (.amicode-composer-controls, now tagged) clips on the x axis (overflow-x: clip). A 4px inline padding offset by a -4px margin keeps the first and last chips' focus rings inside the clip, and clip leaves the y axis visible. Popovers and menus are portaled, so they are unaffected. The trailing wrapper is shrink-0.

  2. Labels ellipsize instead of overlapping. Each chip (agent/model/variant/harness) and its tooltip wrapper (matched with :has) get min-width: 0. The label spans were already truncate. The add button's wrapper is flex-shrink: 0.

  3. Explicit shed order, widest breakpoint first:

    Container width Sheds
    ≤ 36rem variant
    ≤ 32rem harness (kept while the harness is degraded, because it is the only way back)
    ≤ 28rem model label: the model chip goes icon-only (provider icon + chevron). The label is visually hidden, not removed, so the button keeps its accessible name
    ≤ 26rem concise (the existing feat(skills): concise mode — toggleable output-shaping skill #1633 rule, unchanged)

    The agent chip and Send are never shed. The agent label ellipsizes when needed.

About the 26rem concise breakpoint: it fits the new order. The issue noted that the other chips overflowed before 26rem kicked in. Now variant, harness, and model label all shed earlier, so between 26rem and 28rem the row needs only about 290px of the 416px available, and concise is the last to go. I left the value unchanged to preserve #1633's behavior.

Wiring: slot classes on the agent/variant selects (a new optional class passthrough on PromptInputV2ConfiguredSelect), on the model control and its label span, and on the harness trigger. data-harness-degraded sits on the control group. This PR doesn't touch submit.ts or the concise logic (#2171, #2172).

Tests

  • New packages/app/src/components/prompt-input/composer-row-responsive.test.ts (14 tests). Following the repo's pattern, it asserts the CSS and wiring from source: slot class wiring, the x-clip with focus-ring room, shrinkable chips and tooltip wrappers, a non-shrinking add button, one breakpoint per sheddable control in strict priority order, concise kept at 26rem, variant/harness removed with their wrapper, the harness exempt while degraded, and the model label visually hidden (not display: none). I wrote the tests first and saw them fail (RED), then made them pass.
  • In the materialized tree:
    • composer-row-responsive + harness-control + session-header: 45 pass, 0 fail.
    • session-ui src/v2/components/prompt-input: 38 pass, 0 fail.
  • overlay_typecheck_gate.sh: OK across 7 packages. drift_gate.mjs: PASS.
  • These failures exist without this change, in files it doesn't touch:
    • app/.../prompt-input/submit.test.ts: toaster export not found in ui/src/components/toast.tsx.
    • session-ui/.../editable-diff-view.test.ts: 1 cm-selection theme test.

Visual check

I built the app CSS (vite build in the materialized packages/app) and loaded it into a harness page. The page reproduces the row's DOM, tooltip-v2-trigger wrappers included. I rendered it in headless Chrome at composer widths of 320, 400, 520, and 600 px, with typical labels, long labels, and a degraded harness. For each visible control the harness measured the visible rect, tested pairwise overlap, and ran elementFromPoint at the control's center.

  • This branch: 0 overlaps in every case, and every visible control is hit-testable, Send included.
    • 320 and 400 px: add / agent / model (icon-only) / Send. When degraded, the harness is also visible.
    • 520 px: add / agent / model / harness / concise / Send. With long labels they ellipsize.
    • 600 px: all controls are shown.
  • Baseline (same harness, new rules disabled):
    • At 320 px, variant overlaps Send by 21px.
    • At 400 px, harness overlaps Send by 28px.
    • At 520 px, harness overlaps concise by 58px.
    • In several cases Send is not hit-testable (the click lands on a chip).

The layout is the same in light and dark mode: this change touches no color tokens.

Possible follow-up (not done here, to keep this minimal): with very long labels in the 576–650px band, the variant chip can ellipsize down to a single letter before it sheds at 36rem. Weighting flex-shrink toward the model and harness chips would fix that.

🤖 Generated with Claude Code

jacktrnr and others added 2 commits November 24, 2026 09:32
…ths (#2189)

The composer's bottom control row neither wrapped nor shed controls, so at
narrow chat widths the agent/model/variant/harness chips and the concise
toggle crowded and overlapped Send.

- Tag the row's flexible control group (.amicode-composer-controls) and each
  select chip (agent/model/variant/harness) with a slot class.
- The control group clips on the x axis (overflow-x: clip, with a 4px
  padding/-4px margin so focus rings stay inside), and every chip may shrink
  (min-width: 0) so labels ellipsize instead of painting over Send. The
  trailing controls are shrink-0.
- Explicit shed order on the existing amicode-composer container:
  variant (36rem) -> harness (32rem) -> model label (28rem, icon-only, label
  visually hidden so the accessible name stays) -> concise (26rem, unchanged).
  The harness is never shed while degraded (it is the way back).

Closes #2189

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…2189)

Each composer chip's trigger sits inside TooltipV2's
div[data-component="tooltip-v2-trigger"] (display: flex), and that wrapper is
the row's real flex item. min-width: 0 on the button alone never let a chip
shrink, so the wrapper gets min-width: 0 too (via :has), the add button's
wrapper stays flex-shrink: 0, and the variant/harness sheds hide the wrapper
as well so no empty flex item leaves a stray gap.

Verified in headless Chrome against the built CSS at 320/400/520/600 px: no
control overlaps another, and every visible control (Send included) is
hit-testable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf8703db-9387-4d11-a6a7-ad0c7d74e978
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@jacktrnr
jacktrnr marked this pull request as ready for review November 24, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Composer control row crams/overlaps at narrow chat widths (build/model/harness/concise)

1 participant