LibreChat/client
Marco Beretta 3b339219ba
📜 feat: Add Optional Collapse for Long User Messages (#15034)
* feat: add optional collapse for long user messages

Add a Chat > Messages preference (off by default) that clamps long
user messages to a preview height with a gradient fade and a Show
more toggle, so pasted text or code cannot dominate the thread.

The clamp is visual only: overflow-hidden keeps the full text in the
DOM, so it stays readable by assistive tech, copyable, and findable
by in-page search. Renders children untouched while the preference
is off, keeping the DOM identical to before.

* fix: address review findings on the long-message clamp

- Apply the clamp only when content actually overflows, so sub-tolerance
  content is never hidden without a toggle
- Measure the inner unclamped wrapper so growth such as a font size
  change or late media layout re-trips the toggle while collapsed
- Reveal the message when focus reaches clipped content, so links and
  code actions stay reachable without focusing hidden elements
- Reset the reveal when the preference turns off, so re-enabling always
  starts from the collapsed preview

* fix: refine clamp reveal, use Button primitive, cover steer parts

- Reveal on focus only when the focused control is actually clipped, so
  tabbing into a visible link no longer expands the message
- Measure in a layout effect so the first paint carries the clamp
- Render the toggle through the shared Button primitive (link variant)
  instead of feature-local button styling
- Persisted steering messages now collapse under the same preference;
  search-result previews stay unclamped by design

* fix: reveal focused controls clipped by any amount at the boundary

The overflow tolerance exists to absorb trailing markdown margins when
deciding whether the message overflows; the focus check compares the
focused control directly against the clamp boundary instead.
2026-08-21 03:38:01 -04:00
..
public
scripts
src 📜 feat: Add Optional Collapse for Long User Messages (#15034) 2026-08-21 03:38:01 -04:00
sw
test
babel.config.cjs
check_updates.sh
index.html
jest.config.cjs 🚀 chore: Prepare v0.8.8-rc1 (#14394) 2026-08-14 03:24:59 -04:00
jest.resolver.cjs
nginx.conf
package.json 🚀 chore: Prepare v0.8.8-rc1 (#14394) 2026-08-14 03:24:59 -04:00
postcss.config.cjs
tailwind.config.cjs 🎨 feat: Color the Context Gauge by Category and Collapse its Breakdown (#14855) 2026-08-14 22:46:10 -04:00
tsconfig.json
vite.config.ts 🎨 refactor: adopt the @librechat/client design system (semantic color tokens + component migration) (#13879) 2026-08-06 09:15:17 -04:00