Fix: chat messages overflow container breaking layout
Problem
Chat messages containing long lines of text, inline code, or code blocks expand beyond the chat container, breaking the page layout. The content pushes past the right edge of the chat panel instead of wrapping or scrolling within bounds.
Visible symptoms:
- Message bubbles extend beyond the right edge of the chat panel
- Horizontal scrollbar may appear on the page body
- Activity panel gets pushed off-screen or compressed
- Most noticeable with long inline code, monospace text, or unbroken long lines
Root Cause
Classic CSS flexbox overflow bug combined with missing overflow constraints at multiple levels:
1. Chat panel missing min-w-0 (TeamMonitorPage.tsx line 526)
<div className="flex flex-1 flex-col rounded-lg border ...">
In flexbox, the default min-width is auto, which prevents a flex item from shrinking below its content size. When content is wider than the flex allocation, the item grows beyond it. Fix: add min-w-0.
2. Chat scroll area missing horizontal overflow control (line 534)
<div className="flex-1 overflow-y-auto p-4">
Has overflow-y-auto but no overflow-x handling. Fix: add overflow-x-hidden.
3. Message bubble div missing word-break (line 583)
<div className={`rounded-lg px-3 py-2 text-sm ${...}`}>
<MarkdownRenderer>{getChatText(msg)}</MarkdownRenderer>
</div>
No overflow-hidden, overflow-wrap: break-word, or word-break. Long unbroken text expands the bubble. Fix: add overflow-hidden and break-words.
4. Inline <code> in MarkdownRenderer (Markdown.tsx line 44-47)
code: ({ children }) => (
<code className="rounded bg-slate-700/50 px-1 py-0.5 font-mono text-xs">
{children}
</code>
),
No break-all or overflow-wrap. Long inline code snippets (file paths, variable names, URLs) don't wrap. Fix: add break-all or overflow-wrap: anywhere.
5. <pre> container constraint
The <pre> element has overflow-x-auto (good), but since the parent message bubble has no overflow constraint, the auto-scroll doesn't activate correctly.
Affected Files
frontend/src/pages/TeamMonitorPage.tsx— chat panel layout, scroll area, message bubblesfrontend/src/components/Markdown.tsx— inline code and pre element styling
Suggested Fix Points
TeamMonitorPage.tsxline 526: Addmin-w-0to chat panel flex childTeamMonitorPage.tsxline 534: Addoverflow-x-hiddento scroll containerTeamMonitorPage.tsxline 583: Addoverflow-hidden break-wordsto message bubbleMarkdown.tsxline 44-47: Addbreak-allto inline<code>element
Already fixed in commit 6eb5f4e. Closing as completed.