Fix ChatView header overflow for long thread titles #60
main fromcodething/d847b414·merged by juliusmarminge View on GitHubSummary#
- add
min-w-0to ChatView container wrappers so header content can shrink within flex layouts - update header title container to
flex-1 min-w-0and applytruncateto the thread title - add a
titletooltip on the truncated thread name to preserve full-title visibility - mark the header action group as
shrink-0so controls remain stable when titles are long
Testing#
- Not run (no test output provided)
- Visual check: long thread titles should truncate with ellipsis instead of overflowing header controls
Summary by CodeRabbit#
New Features
- Enforced a 4-terminal-per-thread limit; creating or splitting terminals is blocked at the cap and action labels reflect the max.
- Terminal action buttons are disabled and visually dimmed when the limit is reached.
Improvements
- Chat header shows long titles with truncation and tooltip; layout tweaks prevent overflow and unwanted shrinking.
Tests
- Added tests verifying the terminal cap and related behaviors.
Note
Low Risk Mostly UI/layout tweaks plus a straightforward terminal-count cap with added reducer guards and tests; limited blast radius to thread terminal management and display.
Overview
Fixes chat header layout issues with long thread titles by adding min-w-0/truncate and a hover title tooltip, and by marking the actions area as shrink-0 so controls don’t get pushed off-screen.
Introduces a shared MAX_THREAD_TERMINAL_COUNT (set to 4) and enforces it end-to-end: UI actions for split/new terminals are disabled with updated tooltips when at the cap, the reducer ignores attempts to add beyond the limit (including on hydration/normalization), and new tests cover both split and new terminal capping behavior.
- 1
Prevent ChatView header overflow for long thread titles and cap thread terminals at 4 across UI actions and store logic#
Introduce
MAX_THREAD_TERMINAL_COUNT = 4and enforce it in UI actions and reducers; truncate the Chat header title and applymin-w-0/overflow fixes; normalize persisted terminal IDs and validateactiveThreadId.📍Where to Start#
Start with the terminal cap logic in the reducers in store.ts, then review header truncation and overflow fixes in ChatView.tsx.
Macroscope summarized dcc6d9d.Greptile Summary
Fixes header overflow in
ChatViewwhen thread titles are long. Addsmin-w-0to the ChatView flex containers so they can shrink within the parentLayoutflex row, appliestruncateto theh2thread title (with a nativetitletooltip for full-text visibility), and marks the header action buttons asshrink-0so controls remain stable regardless of title length.- Adds
min-w-0to both ChatView wrapper divs (empty state and active thread) to allow proper flex shrinking - Updates
ChatHeaderleft container toflex-1 min-w-0so the title area claims remaining space and can truncate - Adds
truncateandtitleattribute to the thread titleh2 - Marks the right-side action group as
shrink-0to prevent button controls from being compressed
Confidence Score: 5/5
- This PR is safe to merge — it applies minimal, well-understood CSS flex overflow fixes with no behavioral or logic changes.
- The changes are purely cosmetic CSS class additions (
min-w-0,truncate,shrink-0,flex-1) and an HTMLtitleattribute. The flex overflow pattern used here is standard and well-established. No JavaScript logic, state, or component API changes are involved. The Badge component already hasshrink-0in its base styles, so it integrates correctly with the new layout. - No files require special attention.
Important Files Changed
Filename Overview apps/web/src/components/ChatView.tsx Adds min-w-0to outer flex containers, appliestruncatewithtitletooltip to thread title, and marks action buttonsshrink-0to prevent header overflow with long thread names. Standard CSS flex overflow fix with no behavioral regressions.Flowchart
Last reviewed commit: 0a4c070flowchart TD A["Layout (flex h-screen overflow-hidden)"] --> B["Sidebar"] A --> C["ChatView (flex-1 min-w-0)"] A --> D["DiffPanel (conditional)"] C --> E["header (flex justify-between)"] C --> F["Messages area"] E --> G["Left: title container (flex-1 min-w-0)"] E --> H["Right: actions (shrink-0)"] G --> I["h2 thread title (truncate + title tooltip)"] G --> J["Badge project name (shrink-0)"] H --> K["OpenInPicker / GitActions / Diff button"]- Adds
🧹 Nitpick comments (1)
apps/web/src/components/ThreadTerminalDrawer.tsx (1)
718-740: Consider addingaria-disabledfor better accessibility.The buttons are visually styled as disabled but don't communicate this state to assistive technologies. While the tooltip message helps, adding
aria-disabled="true"whenhasReachedTerminalLimitwould improve screen reader accessibility.♿ Proposed accessibility improvement
<TerminalActionButton className={`p-1 text-foreground/90 transition-colors ${ hasReachedTerminalLimit ? "cursor-not-allowed opacity-45 hover:bg-transparent" : "hover:bg-accent" }`} onClick={onSplitTerminalAction} label={splitTerminalActionLabel} + aria-disabled={hasReachedTerminalLimit} >Note: This would require updating the
TerminalActionButtonPropsinterface to accept an optionalaria-disabledprop and pass it through to the button element.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/src/components/ThreadTerminalDrawer.tsx` around lines 718 - 740, The TerminalActionButton instances should convey the disabled state to assistive tech: update the TerminalActionButton component and its TerminalActionButtonProps to accept an optional aria-disabled boolean prop, pass that prop through to the underlying button element, and set aria-disabled={hasReachedTerminalLimit} on both usages (the SquareSplitHorizontal and Plus buttons) when the visual disabled styling is applied; ensure the existing onClick still respects the disabled state (no-op or prevented) to match aria-disabled.🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed. Nitpick comments: In `@apps/web/src/components/ThreadTerminalDrawer.tsx`: - Around line 718-740: The TerminalActionButton instances should convey the disabled state to assistive tech: update the TerminalActionButton component and its TerminalActionButtonProps to accept an optional aria-disabled boolean prop, pass that prop through to the underlying button element, and set aria-disabled={hasReachedTerminalLimit} on both usages (the SquareSplitHorizontal and Plus buttons) when the visual disabled styling is applied; ensure the existing onClick still respects the disabled state (no-op or prevented) to match aria-disabled.Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is [ON](https://www.cursor.com/dashboard?tab=bugbot). A Cloud Agent has been kicked off to fix the reported issue.@@ -733,6 +755,6 @@733755 <div className="min-w-0 flex-1">734756 {isSplitView ? (735757 <div736- className="grid h-full w-full gap-0 overflow-x-auto"758+ className="grid h-full w-full min-w-0 gap-0 overflow-hidden"737759 style={{738- gridTemplateColumns: `repeat(${visibleTerminalIds.length}, minmax(260px, 1fr))`,760+ gridTemplateColumns: `repeat(${visibleTerminalIds.length}, minmax(0, 1fr))`,Split terminal minimum width removed, prevents scrolling#
Low Severity
The grid template changed from
minmax(260px, 1fr)withoverflow-x-autotominmax(0, 1fr)withoverflow-hidden. This removes the 260px minimum width guarantee per split terminal pane and eliminates horizontal scrolling. In narrower viewports or non-maximized windows with multiple split terminals, each pane can become arbitrarily narrow (e.g., ~170px with 4 splits at 1024px), rendering the xterm terminals nearly unusable with no way to scroll to full-width panes.Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.
- ✅ Fixed: Split terminal minimum width removed, prevents scrolling
- Restored
minmax(260px, 1fr)andoverflow-x-autoon the split terminal grid while keeping themin-w-0class that prevents the grid from expanding the parent flex container, preserving the header overflow fix.
- Restored
Or push these changes by commenting:
@cursor push cfabf9bd03Preview (pingdotgg/codething-mvp@cfabf9bd03)
diff --git a/apps/web/src/components/ThreadTerminalDrawer.tsx b/apps/web/src/components/ThreadTerminalDrawer.tsx --- a/apps/web/src/components/ThreadTerminalDrawer.tsx +++ b/apps/web/src/components/ThreadTerminalDrawer.tsx @@ -755,9 +755,9 @@ <div className="min-w-0 flex-1"> {isSplitView ? ( <div - className="grid h-full w-full min-w-0 gap-0 overflow-hidden" + className="grid h-full w-full min-w-0 gap-0 overflow-x-auto" style={{ - gridTemplateColumns: `repeat(${visibleTerminalIds.length}, minmax(0, 1fr))`, + gridTemplateColumns: `repeat(${visibleTerminalIds.length}, minmax(260px, 1fr))`, }} > {visibleTerminalIds.map((terminalId) => (- ✅ Fixed: Split terminal minimum width removed, prevents scrolling
juliusmarminge merged this376efdd
juliusmarminge closed this
Sign in to join this conversation.



Walkthrough#
Adds a MAX_THREAD_TERMINAL_COUNT limit (value 4) and enforces it across UI and store: ChatView and ThreadTerminalDrawer now guard split/new terminal actions and adjust layout/labels when the cap is reached; store normalization and reducers prevent creating terminals beyond the cap; tests added to validate behavior.
Changes#
apps/web/src/components/ChatView.tsxMAX_THREAD_TERMINAL_COUNTimport andChatImageAttachmenttype. AddedhasReachedTerminalLimitlogic to short-circuitsplitTerminalandcreateNewTerminal. Addedmin-w-0to empty-state and main content containers; updated ChatHeader title rendering with truncation andtitleattribute and adjusted flex/shrink classes.apps/web/src/components/ThreadTerminalDrawer.tsxMAX_THREAD_TERMINAL_COUNTandhasReachedTerminalLimit. Wrapped split/new actions with guarded handlers that no-op when limit reached, update action labels to reflect limit, disable/dim buttons and suppress hover when capped, and adjust layout/grid overflow classes for terminal panels.apps/web/src/store.tsMAX_THREAD_TERMINAL_COUNT. Normalization now deduplicates and slices terminal lists to the max, ensures valid activeThreadId fallback, and reducers forSPLIT_THREAD_TERMINAL/NEW_THREAD_TERMINALskip creating new terminals when the cap would be exceeded.apps/web/src/store.test.tsMAX_THREAD_TERMINAL_COUNTand verifies terminal count, ordering, and active terminal behavior near the cap.apps/web/src/types.tsMAX_THREAD_TERMINAL_COUNT = 4.Sequence Diagram(s)#
Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)#
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.