Skip to content

fix: prevent Insights chat panel from scrolling off-screen#1996

Open
octo-patch wants to merge 1 commit intoAndyMik90:developfrom
octo-patch:fix/issue-1977-insights-scroll
Open

fix: prevent Insights chat panel from scrolling off-screen#1996
octo-patch wants to merge 1 commit intoAndyMik90:developfrom
octo-patch:fix/issue-1977-insights-scroll

Conversation

@octo-patch
Copy link
Copy Markdown

@octo-patch octo-patch commented Apr 5, 2026

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 missing min-h-0. Without it, the default flex min-height: auto allows the flex child to grow taller than its parent. This causes the ScrollArea inside to also grow unconstrained, overflowing the layout and scrolling off-screen.

Solution

Add min-h-0 to the main chat area flex container in Insights.tsx:

- <div className="flex flex-1 flex-col">
+ <div className="flex flex-1 flex-col min-h-0">

This constrains the flex child to its parent's height, allowing the ScrollArea to properly contain the messages within the viewport.

Note: The scrollIntoView issue mentioned in the bug report was already addressed in a prior refactor — the component now uses the viewportEl ref directly (viewportEl.scrollTop = viewportEl.scrollHeight) instead of scrollIntoView().

Testing

  • Verified the fix by checking the min-h-0 presence resolves the flex min-height constraint issue
  • The reporter of the original issue confirmed a similar patch to app.asar resolved the scrolling behavior

Summary by CodeRabbit

  • Style
    • Improved layout behavior in the Insights section to ensure the main chat area properly adjusts its size within the interface.

…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.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6a88fa04-b1dc-4ffd-affa-618265ac53c3

📥 Commits

Reviewing files that changed from the base of the PR and between cba7a02 and 7db7d56.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/components/Insights.tsx

📝 Walkthrough

Walkthrough

Updated the main chat area container in the Insights component to include the min-h-0 CSS class, enabling proper flex shrinking within its parent column and preventing the ScrollArea from growing unconstrained.

Changes

Cohort / File(s) Summary
Insights Layout Fix
apps/desktop/src/renderer/components/Insights.tsx
Added min-h-0 class to the main chat container flex layout to correct flex sizing behavior and prevent unconstrained growth of the inner ScrollArea.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A tiny class, so small and neat,
Makes the scrolling area quite complete!
min-h-0 works its subtle magic,
No more panels scrolling off—how tragic!
Flex containers now behave just right,
Our Insights chat gleams in the light! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses issue #1977. It implements the first fix (adding min-h-0) but does not implement the second required fix (updating scrollIntoView to target the ScrollArea viewport). Implement the second fix from #1977: update the auto-scroll effect to target the Radix ScrollArea viewport directly using el.closest("[data-radix-scroll-area-viewport]") instead of relying on scrollIntoView().
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: adding min-h-0 to prevent the Insights chat panel from scrolling off-screen, which directly addresses the issue.
Out of Scope Changes check ✅ Passed The changes are scoped to the Insights component and directly address the flex layout issue described in #1977; no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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).

Suggested change
<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">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Insights chat panel scrolls off-screen after messages load

2 participants