Skip to content

feat(desktop): clamp sticky human messages to ~2 lines until hover/focus#37877

Merged
OutThisLife merged 6 commits into
mainfrom
bb/desktop-sticky-msg-clamp
Jun 3, 2026
Merged

feat(desktop): clamp sticky human messages to ~2 lines until hover/focus#37877
OutThisLife merged 6 commits into
mainfrom
bb/desktop-sticky-msg-clamp

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

Long user prompts stick to the top of the thread while the response streams beneath them, so a multi-line prompt could eat most of the viewport. This clamps the read-only human bubble's text to ~2 lines with a soft bottom fade; the clamp lifts on hover or keyboard focus, and clicking the bubble still opens the edit composer (which already shows the full text). Short messages are untouched — no clamp, no fade.

Changes

  • thread.tsx (UserMessage) — wraps the message text in a .sticky-human-clamp element and measures an unclamped inner wrapper via useResizeObserver, so the observer only fires on real content/width changes, not every frame while the outer max-height animates open. Sets data-clamped only when the text actually exceeds 2 lines, and writes the measured height to --human-msg-full.
  • styles.css — the clamp (max-height ≈ 2 lines + overflow: hidden), the fade mask-image (gated on [data-clamped='true']), and the hover/focus-within expansion (animates to --human-msg-full, capped at 24rem with internal scroll), all with a 0.2s max-height transition.

Branches off main (after #37866 merged).

Test plan

  • Send a long (>2 line) prompt; confirm the sticky bubble shows ~2 lines + fade while the response streams.
  • Hover the bubble → expands to full (or scrolls if very long); leaving collapses it.
  • Tab to the bubble (keyboard focus) → expands; click → opens edit composer with full text.
  • Short (1–2 line) prompts show no clamp and no fade.
  • Tunable knobs (clamp height, 55% fade start, 24rem cap, 0.2s) behave as expected.

🤖 Generated with Cursor

Long user prompts stick to the top of the thread while the response streams
beneath them, so a multi-line prompt could eat most of the viewport. Clamp the
read-only human bubble's text to ~2 lines with a soft bottom fade; the clamp
lifts on hover or keyboard focus, and clicking the bubble still opens the edit
composer (which shows the full text). Short messages are untouched — no clamp,
no fade.

Overflow is measured on an unclamped inner wrapper so the ResizeObserver only
fires on real content/width changes, not every frame while the outer
max-height animates open; the measured height feeds --human-msg-full so
expand/collapse animate to the true height instead of overshooting the cap.
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: bb/desktop-sticky-msg-clamp vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9707 on HEAD, 9707 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5029 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have labels Jun 3, 2026
@OutThisLife OutThisLife merged commit 2f0ee66 into main Jun 3, 2026
6 checks passed
@OutThisLife OutThisLife deleted the bb/desktop-sticky-msg-clamp branch June 3, 2026 04:45
davidgut1982 pushed a commit to davidgut1982/hermes-agent that referenced this pull request Jun 5, 2026
…icky-msg-clamp

feat(desktop): clamp sticky human messages to ~2 lines until hover/focus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants