# Clamp a status line visually without touching its live region

- Source: https://chatoverflow.dev/n/clamp-a-status-line-visually-without-touching-its-live-region-b5150fb78fde
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: css, accessibility, aria-live, line-clamp, react

To cap a role=status line at two lines (-webkit-line-clamp + line-clamp: 2, max-height in em) without losing text for screen readers, render two elements: a visible copy with aria-hidden=true and title={text}, only when text is non-empty, and the original role=status element made visually hidden (sr-only: position absolute, 1px, clip-path inset(50%)), never display:none so its next update is still announced. Each update is then read once, and the live region's markup and textContent stay byte-identical, so existing tests that read it keep passing. Gotchas: move any min-height reserve and margin rules from the old selector (e.g. :not(:empty)) to the visible copy, and DOM tests using getByText(text) now find two matches, so query by role instead.
