fix: prevent Insights chat panel from scrolling off-screen#1996
fix: prevent Insights chat panel from scrolling off-screen#1996octo-patch wants to merge 1 commit intoAndyMik90:developfrom
Conversation
…yMik90#1977) Without min-h-0 on the flex container, the default flex min-height is 'auto', allowing the child to grow beyond its parent's bounds. This causes the ScrollArea to also grow unconstrained, making the Insights panel scroll off the top of the screen after messages load.
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughUpdated the main chat area container in the Insights component to include the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Code Review
This pull request updates the main chat area container in the Insights component by adding the min-h-0 utility class to manage vertical expansion. The reviewer suggested further enhancing layout robustness by including min-w-0 and overflow-hidden to prevent horizontal overflow and ensure content is properly clipped within the flex container.
|
|
||
| {/* Main Chat Area */} | ||
| <div className="flex flex-1 flex-col"> | ||
| <div className="flex flex-1 flex-col min-h-0"> |
There was a problem hiding this comment.
While adding min-h-0 correctly addresses the vertical expansion issue, it is recommended to also add overflow-hidden and min-w-0 to this container for better layout robustness.\n\n- overflow-hidden ensures that any content that might exceed the container's bounds is clipped, preventing unwanted scrollbars on the main window.\n- min-w-0 prevents the container from expanding horizontally if it contains long, non-wrapping content (like code blocks), which is important since this container is a flex item in a horizontal layout (the parent div at line 387 is flex-row).
| <div className="flex flex-1 flex-col min-h-0"> | |
| <div className="flex flex-1 flex-col min-h-0 min-w-0 overflow-hidden"> |
Fixes #1977
Problem
The Insights chat panel becomes invisible after messages load. The content briefly flashes on screen, then scrolls off the top of the viewport and cannot be seen without zooming out.
The inner flex container
<div className="flex flex-1 flex-col">was missingmin-h-0. Without it, the default flexmin-height: autoallows the flex child to grow taller than its parent. This causes theScrollAreainside to also grow unconstrained, overflowing the layout and scrolling off-screen.Solution
Add
min-h-0to the main chat area flex container inInsights.tsx:This constrains the flex child to its parent's height, allowing the
ScrollAreato properly contain the messages within the viewport.Note: The
scrollIntoViewissue mentioned in the bug report was already addressed in a prior refactor — the component now uses theviewportElref directly (viewportEl.scrollTop = viewportEl.scrollHeight) instead ofscrollIntoView().Testing
min-h-0presence resolves the flex min-height constraint issueapp.asarresolved the scrolling behaviorSummary by CodeRabbit