Skip to content

fix(queued-messages): clamp long queued messages to 3 lines#3163

Open
harshjainnn wants to merge 2 commits into
PostHog:mainfrom
harshjainnn:fix/clamp-long-queued-messages
Open

fix(queued-messages): clamp long queued messages to 3 lines#3163
harshjainnn wants to merge 2 commits into
PostHog:mainfrom
harshjainnn:fix/clamp-long-queued-messages

Conversation

@harshjainnn

Copy link
Copy Markdown

Long queued messages (e.g. a pasted code block) previously rendered at full height, and this compounded with multiple queued messages, pushing the composer off-screen. Clamp to 3 lines with a fade mask and a 'Show more/less' toggle, mirroring the clamp pattern already used for sent messages in ChatThread's UserBubble.

Fixes #3150

Problem

Queued follow-up messages render at full height with no clamp. A long queued message (e.g. a pasted code block) can grow the dock to hundreds of pixels tall, and this compounds when multiple long messages are queued at once — pushing the composer off-screen.

Changes

Clamped QueuedMessageView content to 3 lines by default, with a bottom fade mask and a "Show more/less" toggle that only appears when the content actually overflows the clamp. This mirrors the existing clamp-by-measured-height pattern used in ChatThread.tsx's UserBubble for sent messages — a ResizeObserver compares scrollHeight against the clamped clientHeight, since overflow can't be determined from character count alone (it depends on wrap width).

Also changed the outer row's alignment from align="center" to align="start" so the icon and action buttons (Steer/Edit/Discard) stay pinned to the top when content spans multiple lines, instead of being vertically centered against a tall block.

How did you test this?

  • Queued several short messages — dock renders unchanged, no toggle appears.
  • Queued a message containing a long code block — content clamps to 3 lines with a fade, "Show more" expands it, "Show less" re-collapses it.
  • Queued a mix of short and long messages together — short ones render untouched, long ones clamp independently of each other.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Long queued messages (e.g. a pasted code block) previously rendered at full height, and this compounded with multiple queued messages, pushing the composer off-screen. Clamp to 3 lines with a fade mask and a 'Show more/less' toggle, mirroring the clamp pattern already used for sent messages in ChatThread's UserBubble.

Fixes PostHog#3150
@trunk-io

trunk-io Bot commented Jul 6, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@harshjainnn

Copy link
Copy Markdown
Author

/trunk merge

@trunk-io

trunk-io Bot commented Jul 6, 2026

Copy link
Copy Markdown

An error occurred while submitting your PR to the queue: Only users that are a part of this repo's Trunk organization or have write permissions to the repo can submit a PR to the queue

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(queued-messages): clamp long queued ..." | Re-trigger Greptile

Screen readers need aria-expanded on disclosure widgets to announce collapsed/expanded state. Addresses review feedback on the queued message clamp added for PostHog#3150.
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.

we probably need a way of visually shortening multiple long queued messages

1 participant