Skip to content

fix(tui): make overlay cards fit narrow Nav pane - #1440

Merged
namastex888 merged 3 commits into
mainfrom
fix/tui-overlay-narrow-pane
Apr 28, 2026
Merged

namastex888 merged 3 commits into
mainfrom
fix/tui-overlay-narrow-pane

Conversation

@namastex888

@namastex888 namastex888 commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The @opentui/react tree in app.tsx renders only <Nav> — the right pane is a tmux split outside React. Every overlay rendered inside Nav is therefore constrained to the Nav pane's width.
  • Inner-card boxes for AgentPicker (80), TeamCreate (64), SpawnTargetPicker (60) and ContextMenu (32) hard-coded fixed pixel widths that overflowed narrow tmux splits, producing the "menus don't fit my left-menu TUI" symptom.
  • Switched all four cards to 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 | string already accepts "100%"; the backdrop wrapper already used it)
  • Manual QA on a narrow tmux split: open the TUI, trigger each overlay (. for context menu, Ctrl+T for team-create, "Spawn into…" via context menu, "Spawn here…" via session/window context menu) — confirm cards fit without clipping.
  • Manual QA on a wide tmux split — confirm cards still center and remain readable.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Style
    • Updated component layouts to use responsive widths instead of fixed dimensions, allowing UI elements to better adapt to available space. Changes applied to AgentPicker, ContextMenu, SpawnTargetPicker, and TeamCreate components.

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>
@coderabbitai

coderabbitai Bot commented Apr 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • test/visual/__snapshots__/tui-snapshot.test.tsx.snap is excluded by !**/*.snap

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a795b8d6-1ca4-470f-b90e-bb8f4ee62fad

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Four 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

Cohort / File(s) Summary
Responsive Width Adjustments
src/tui/components/AgentPicker.tsx, src/tui/components/ContextMenu.tsx, src/tui/components/SpawnTargetPicker.tsx, src/tui/components/TeamCreate.tsx
Width property changed from fixed numeric values (80, 32, 60, 64) to responsive "100%" for modal and menu inner containers.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(tui): make overlay cards fit narrow Nav pane' directly describes the main change: adapting overlay card widths to fit narrow navigation panes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tui-overlay-narrow-pane

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 | 🟠 Major

Fixed 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

📥 Commits

Reviewing files that changed from the base of the PR and between b32f761 and 5d88163.

📒 Files selected for processing (4)
  • src/tui/components/AgentPicker.tsx
  • src/tui/components/ContextMenu.tsx
  • src/tui/components/SpawnTargetPicker.tsx
  • src/tui/components/TeamCreate.tsx

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

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.

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.

Comment on lines +96 to 97
width="100%"
height={inputMode ? items.length + 5 : items.length + 2}

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.

high

While width="100%" prevents the container from overflowing narrow panes, it introduces two issues:

  1. The inner input component (line 123) has a hardcoded width={28}. If the pane is narrower than ~30 characters (including borders), the input will overflow the menu's borders.
  2. The fixed height calculation 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%"

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

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.

Comment on lines 129 to +132
paddingX={3}
paddingY={1}
flexDirection="column"
width={64}
width="100%"

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

With width="100%" and paddingX={3}, the usable content width becomes extremely restricted on narrow panes (e.g., only 2 characters wide on a 10-character pane). Consider reducing the horizontal padding or making it responsive to ensure the form remains usable in narrow tmux splits.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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%"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

namastex888 and others added 2 commits April 28, 2026 01:47
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>
@namastex888
namastex888 merged commit ca0a1d8 into main Apr 28, 2026
10 checks passed
@automagik-genie
automagik-genie deleted the fix/tui-overlay-narrow-pane branch September 25, 2026 04:51
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.

1 participant