Skip to content

Insights chat panel scrolls off-screen after messages load #1977

Description

@sethstevenson

Bug Description

The Insights chat panel becomes invisible after messages load. The content briefly flashes on screen, then smoothly scrolls off the top of the viewport and cannot be seen without zooming out in the Electron window.

Root Cause

Two issues in src/renderer/src/components/insights/Insights.tsx (or equivalent):

1. Missing min-h-0 overflow-hidden on inner flex column

The main content div uses flex flex-1 flex-col but is missing min-h-0 overflow-hidden. Without min-h-0, the flex item respects its default min-height: auto, allowing it to grow taller than its parent. This causes the ScrollArea inside to also grow unconstrained.

Fix: Change "flex flex-1 flex-col""flex flex-1 flex-col min-h-0 overflow-hidden"

2. scrollIntoView scrolls the wrong ancestor

The effect that auto-scrolls to the latest message uses:

messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });

Chromium (and therefore Electron) allows programmatic scrolling of overflow: hidden elements. The <main> layout container has overflow-hidden, so scrollIntoView bubbles up past the ScrollArea viewport and scrolls <main> instead — pushing the entire Insights panel above the top of the screen.

Fix: Target the Radix UI ScrollArea viewport directly:

useEffect(() => {
  const el = messagesEndRef.current;
  if (el) {
    const viewport = el.closest("[data-radix-scroll-area-viewport]");
    if (viewport) {
      viewport.scrollTo({ top: viewport.scrollHeight, behavior: "smooth" });
    } else {
      el.scrollIntoView({ behavior: "smooth" });
    }
  }
}, [session?.messages, streamingContent]);

Steps to Reproduce

  1. Open a project with existing Insights chat history (multiple messages)
  2. Navigate to the Insights view
  3. The messages briefly appear, then the entire panel scrolls off the top of the screen
  4. Only the input box at the bottom remains visible

Environment

  • macOS (Electron app)
  • Aperant v2.7.5

Notes

Both fixes were verified by patching the installed app.asar directly. The content stays properly visible after applying them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions