fix(chat): stop scrolled-away messages rendering as tall empty boxes - #1167
fix(chat): stop scrolled-away messages rendering as tall empty boxes#1167materemias wants to merge 1 commit into
Conversation
`content-visibility: auto` sizes an off-screen element by `contain-intrinsic-size` rather than by its content, and the reserved sizes were guesses: a collapsed tool row is about 32px and was reserving 240px, so messages scrolled out of view became tall empty boxes with their text floating inside them. The `auto` keyword makes it worse rather than better - the browser then remembers the last rendered height, so a row expanded once (a diff, a long tool output) keeps that height forever while skipped. Messages are already paginated, so the DOM stays small and skipping off-screen work buys little. Keep the paint/layout isolation, drop the sizing.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe ChangesChat message styles
Suggested reviewers: Poem
Merge Risk: ⚪ Minimal · up to This localized CSS change removes incorrect off-screen size reservation while retaining layout and paint isolation; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes a UI rendering issue in the chat message list where messages scrolled out of view could reserve incorrect height and appear as tall empty boxes, by removing content-visibility: auto and the associated contain-intrinsic-size heuristics while keeping per-message containment.
Changes:
- Removed
content-visibility: autofrom.chat-messageto avoid incorrect off-screen sizing behavior. - Removed all
contain-intrinsic-sizereservations for chat message variants (assistant/user/tool/error). - Added an in-file comment documenting the rationale and observed browser behavior.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
content-visibility: autosizes an off-screen element bycontain-intrinsic-sizerather than by its content, and the reserved sizes wereguesses: a collapsed tool row is about 32px and was reserving 240px, so
messages scrolled out of view became tall empty boxes with their text floating
inside them.
The
autokeyword makes it worse rather than better - the browser thenremembers the last rendered height, so a row expanded once (a diff, a long tool
output) keeps that height forever while skipped. Messages are already
paginated, so the DOM stays small and skipping off-screen work buys little.
Keep the paint/layout isolation, drop the sizing.
Summary by CodeRabbit