Skip to content

fix(chat): autosize long prompts in the composer - #6495

Merged
waleedlatif1 merged 4 commits into
stagingfrom
fix/chat-composer-autosize
Aug 10, 2026
Merged

fix(chat): autosize long prompts in the composer#6495
waleedlatif1 merged 4 commits into
stagingfrom
fix/chat-composer-autosize

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

The initial (hero) composer was pinned to a fixed h-[56px], so a long prompt scrolled inside a two-line box instead of growing. Both views now share one sizing policy — cap at 200px, autosize between — with a 56px resting floor for the hero composer.

- className={isInitialView ? 'h-[56px]' : 'max-h-[200px]'}
+ className={cn('max-h-[200px]', isInitialView && 'min-h-[56px]')}

An earlier revision of this branch also restyled the composer's scrollbar (visible thumb, stable gutter, hover reveal). That has been reverted — it did not do what it claimed, and it cost real layout:

  • Chrome ignores ::-webkit-scrollbar customization whenever scrollbar-width is set, and globals.css already applies * { scrollbar-width: thin }. The 4px width, pill radius and 8px track inset were inert. Measured: scrollbar-width:thin + ::-webkit-scrollbar{width:4px} → 11px; with scrollbar-width:auto → 4px.
  • What did survive was scrollbar-gutter: stable, which permanently reserved the 11px thin scrollbar. Prompt text sat 11px off-centre — 14px/25px left/right, against 14px/14px before — for every prompt, including a one-word one.
  • hover:[&::-webkit-scrollbar-thumb]:… compiles to …::-webkit-scrollbar-thumb:hover, so it targeted the thumb rather than the container, and emitted after the sibling rule at equal specificity — silently overriding the hover colour it sat next to.

The margin/padding pair and the 8px bottom margin went with it; they existed only to position that scrollbar.

Tests

The class-literal assertions are replaced with coverage that can actually fail. The previous scrollHeight stub returned the content height unconditionally, so deleting textarea.style.height = 'auto' — the entire reason autosize can shrink — still passed every test.

The stub now models the browser rule that scroll height is the greater of the text height and the box the element is pinned to. Deleting that collapse now turns both the new shrink test and the existing widen-back test red.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other

Testing

  • bunx vitest run app/workspace/[workspaceId]/home/components/user-input/ — 6 files, 41 tests passed
  • Mutation-checked the new coverage: removing the height = 'auto' collapse turns 2 tests red; restoring it turns them green
  • Geometry measured in Chromium and WebKit via Playwright against the compiled Tailwind output (source of the 11px / 14px-vs-25px numbers above)
  • bun run type-check, bunx biome check, bun run check:api-validation — all pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 10, 2026 6:53pm

Request Review

@cursor

cursor Bot commented Aug 10, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI-only composer sizing and test improvements in the chat input; no auth, data, or API changes.

Overview
The hero chat composer no longer uses a fixed 56px height that trapped long prompts in a tiny scroll box. PromptEditor now always caps at 200px and autosizes with content, while the initial view keeps a 56px minimum via min-h-[56px] instead of h-[56px].

Autosize tests were tightened so they can catch regressions: the scrollHeight stub now returns the max of content height and the pinned inline height (matching browsers), and a new case asserts the textarea shrinks when the prompt shortens—covering the height = 'auto' collapse step that growth-only measuring would miss.

Reviewed by Cursor Bugbot for commit 956634d. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR lets the initial chat composer grow with long prompts while retaining a 56px resting floor and a 200px cap.

  • Replaces the initial composer’s fixed height with shared minimum/maximum sizing constraints.
  • Strengthens autosize tests so shrinking requires clearing the textarea’s inline height before measurement.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx Replaces the initial composer’s fixed height with a conditional 56px minimum and shared 200px maximum.
apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/prompt-editor.test.tsx Improves the scroll-height model and adds coverage for shrinking after prompt content becomes shorter.

Reviews (3): Last reviewed commit: "fix(chat): drop the composer scrollbar r..." | Re-trigger Greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

Follow-up in 3605bd7 moves the prompt scroller 6px into the composer right padding while preserving text width, and adds an 8px gap above the toolbar so the scrollbar ends clear of the send button. The focused 10-test suite, Biome, and type-check pass.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

demo:

Screen.Recording.2026-08-10.at.11.07.33.AM.mov

The scrollbar half of this branch did not do what it claimed. Chrome
ignores `::-webkit-scrollbar` customization whenever `scrollbar-width` is
set, and globals.css already sets `* { scrollbar-width: thin }`, so the
4px width, the pill radius and the 8px track inset were all inert. What
survived was `scrollbar-gutter: stable`, which permanently reserved the
11px thin scrollbar and pushed the prompt text 11px off-centre (measured
14px/25px left/right against 14px/14px before) even for a one-word
prompt. `hover:[&::-webkit-scrollbar-thumb]:…` also compiles to
`::-webkit-scrollbar-thumb:hover`, so it targeted the thumb rather than
the container and silently overrode the hover colour it sat next to.

Revert SCROLLER_CLASSES to the hidden scrollbar it had before, and drop
the margin/padding pair and the 8px bottom margin that only existed to
position that scrollbar.

The actual bug fix stays: the initial view was pinned to `h-[56px]`, so a
long prompt scrolled inside a two-line box. Both views now share one
sizing policy — cap at 200px, autosize between — with a 56px resting
floor for the hero composer.

Replace the class-literal assertions with coverage that can fail. The old
scrollHeight stub returned the content height unconditionally, so
deleting the `height = 'auto'` collapse — the entire reason autosize can
shrink — still passed every test. The stub now models the browser rule
that scroll height is the greater of the text height and the pinned box,
which makes both the new shrink test and the existing widen-back test go
red when that collapse is removed.
@waleedlatif1 waleedlatif1 changed the title fix(chat): autosize long prompts in composer fix(chat): autosize long prompts in the composer Aug 10, 2026
@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 956634d. Configure here.

@waleedlatif1
waleedlatif1 merged commit 258a37c into staging Aug 10, 2026
31 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/chat-composer-autosize branch August 10, 2026 19:44
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.

2 participants