Repository navigation
fix(tui): make overlay cards fit narrow Nav pane - #1440
Conversation
The @opentui/react tree in app.tsx renders only <Nav> — the right pane is a tmux split outside React. So every overlay rendered inside Nav is constrained to the Nav pane's width, but the cards were authored with fixed pixel widths that overflow narrow tmux splits. Replace the inner card width on AgentPicker (80), TeamCreate (64), SpawnTargetPicker (60) and ContextMenu (32) with width="100%" so the card scales to the actual pane. The absolute-positioned backdrop already centers the card on wider panes via justifyContent/alignItems, and the border + paddingX preserve visual identity. Validated: bun test src/tui/components → 21 pass / 0 fail; tsc --noEmit clean. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughFour TUI modal and menu components were updated to use responsive full-width layout instead of fixed width values, allowing their inner content containers to expand to available horizontal space. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/tui/components/ContextMenu.tsx (1)
96-127:⚠️ Potential issue | 🟠 MajorFixed input width still breaks narrow panes in input mode.
Line 96 is responsive, but Line 123 keeps
width={28}. In narrow splits, the input can still clip/overflow. Make the input responsive too.Proposed fix
- <input + <input onChange={handleInputChange} onSubmit={handleInputSubmit as () => void} placeholder="Type and press Enter..." focused - width={28} + width="100%" backgroundColor={palette.bg} textColor={palette.text} placeholderColor={palette.textMuted} />🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/tui/components/ContextMenu.tsx` around lines 96 - 127, The input's fixed width (width={28}) in ContextMenu.tsx causes clipping in narrow panes when inputMode is true; update the <input> element used with inputMode (the one using handleInputChange and handleInputSubmit) to be responsive instead of a hard-coded 28: remove or replace width={28} with a responsive sizing approach such as width="100%" or adding flexGrow={1} (and/or compute width from the parent/container) so the input expands to available space and no longer overflows in narrow splits.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/tui/components/ContextMenu.tsx`:
- Around line 96-127: The input's fixed width (width={28}) in ContextMenu.tsx
causes clipping in narrow panes when inputMode is true; update the <input>
element used with inputMode (the one using handleInputChange and
handleInputSubmit) to be responsive instead of a hard-coded 28: remove or
replace width={28} with a responsive sizing approach such as width="100%" or
adding flexGrow={1} (and/or compute width from the parent/container) so the
input expands to available space and no longer overflows in narrow splits.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: be0176db-8ba1-4945-978e-db50321fda07
📒 Files selected for processing (4)
src/tui/components/AgentPicker.tsxsrc/tui/components/ContextMenu.tsxsrc/tui/components/SpawnTargetPicker.tsxsrc/tui/components/TeamCreate.tsx
There was a problem hiding this comment.
Code Review
This pull request updates the AgentPicker, ContextMenu, SpawnTargetPicker, and TeamCreate components to use a responsive width="100%" instead of fixed pixel widths. While this improves adaptability to different pane sizes, the review highlights several layout concerns: ContextMenu may experience inner component overflow and vertical clipping due to fixed height calculations; AgentPicker loses its horizontal centering, suggesting a maxWidth approach instead; and TeamCreate's high horizontal padding may restrict usable space on narrow screens.
| width="100%" | ||
| height={inputMode ? items.length + 5 : items.length + 2} |
There was a problem hiding this comment.
While width="100%" prevents the container from overflowing narrow panes, it introduces two issues:
- The inner
inputcomponent (line 123) has a hardcodedwidth={28}. If the pane is narrower than ~30 characters (including borders), the input will overflow the menu's borders. - The fixed
heightcalculation on line 97 does not account for text wrapping. In narrow panes, if the input label or menu items wrap to multiple lines, they will be vertically clipped.
Consider removing the fixed height and ensuring inner components use relative widths (e.g., width="100%" for the input) to fully support narrow layouts.
| borderColor={palette.borderActive} | ||
| backgroundColor={palette.bgRaised} | ||
| width={80} | ||
| width="100%" |
There was a problem hiding this comment.
Setting width="100%" causes the card to fill the entire width of the navigation pane. This appears to contradict the PR description, which states that the backdrop's justifyContent="center" still centers the card on wider panes. For a child with 100% width, horizontal centering has no effect. If the intention was to maintain a maximum width of 80 while allowing it to shrink on narrow panes, consider using maxWidth={80} (if supported by the library) or a conditional width calculation.
| paddingX={3} | ||
| paddingY={1} | ||
| flexDirection="column" | ||
| width={64} | ||
| width="100%" |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d881630c0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| borderColor={palette.borderActive} | ||
| backgroundColor={palette.bgRaised} | ||
| width={32} | ||
| width="100%" |
There was a problem hiding this comment.
Preserve click-away area by limiting context menu width
The context menu relies on the outer overlay's onMouseDown to close when clicking outside, while the inner menu stops propagation. Making the inner menu width="100%" removes the horizontal outside area for the menu rows, so mouse clicks that previously dismissed the menu now land inside it and can select/trigger menu actions instead. This is most noticeable when users right-click a node and then click elsewhere on the same row region to dismiss; constraining width (or using a max-width strategy) keeps narrow-pane support without breaking click-away behavior.
Useful? React with 👍 / 👎.
The previous commit (5d88163) switched AgentPicker, TeamCreate, SpawnTargetPicker and ContextMenu inner cards from fixed pixel widths (80/64/60/32) to width="100%" so they fit narrow tmux Nav panes. The visual-regression suite pins the rendered row-by-row layout, so every overlay snapshot needs to be regenerated to reflect the new full-width cards. Pure snapshot churn — no production-code changes in this commit. Validated: bun test test/visual/ -u → 17 pass / 0 fail, +17 snapshots. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Same one-row drift documented in b37e523 by felipe: my regen in 825a8dd inadvertently overwrote the canonical bg=#0a1d2a value with the local OpenTUI render's bg=#0f2638 on row 12 of the TeamCreate step-1 snapshot. The source explicitly sets `backgroundColor={palette.bg}` on the input (palette.bg = #0a1d2a in the Lumon-MDR theme). Local OpenTUI native bindings render the empty input placeholder with the parent box's bgRaised (#0f2638) — CI is right, local is wrong here. Hand-edited row 12 only; the four width=100% snapshot updates from 825a8dd are preserved. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
app.tsxrenders only<Nav>— the right pane is a tmux split outside React. Every overlay rendered insideNavis therefore constrained to the Nav pane's width.AgentPicker(80),TeamCreate(64),SpawnTargetPicker(60) andContextMenu(32) hard-coded fixed pixel widths that overflowed narrow tmux splits, producing the "menus don't fit my left-menu TUI" symptom.width="100%"so they scale to the actual pane. The absolute-positioned backdrop already centers the card on wider panes (justifyContent="center"+alignItems="center"), and the border + paddingX preserve visual identity.Test plan
bun test src/tui/components— 21 pass / 0 fail (3.13 s)bun run typecheck(tsc --noEmit) — clean (width: number | stringalready accepts"100%"; the backdrop wrapper already used it).for context menu,Ctrl+Tfor team-create, "Spawn into…" via context menu, "Spawn here…" via session/window context menu) — confirm cards fit without clipping.🤖 Generated with Claude Code
Summary by CodeRabbit