Skip to content

fix(tab-bar): keep tab menu items on one line and give every item an icon - #10882

Merged
nwparker merged 2 commits into
mainfrom
nwparker/tab-menu-inconsistancies
Jul 27, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/tab-menu-inconsistancies

Conversation

@nwparker

@nwparker nwparker commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two inconsistencies in the tab context menus:

  1. "Close All Editor Tabs" wrapped onto a second line. The editor tab menu was pinned to w-48 (192px), which isn't wide enough for that label plus its ⌘⌥W shortcut chip.
  2. Some items had no icon — Close Others and Close Tabs To The Left rendered as bare text while their neighbours all had one.

The wrap is worse off macOS: the chip is built by formatKeybinding, which renders Ctrl+Alt+W on Windows/Linux instead of the narrower ⌘⌥W, so a fixed width that barely fits on Mac clips harder everywhere else. Longer locales compound it (es renders "Cerrar todas las pestañas del editor").

Fix: replaced the fixed w-48 / w-56 widths with a shared rule in tab-context-menu-sizing.ts — min-w-[13rem] max-w-[calc(100vw-1rem)] whitespace-nowrap — so menus grow to fit content instead of wrapping, bounded by the viewport. Submenus get the same rule explicitly since they portal out and don't inherit the parent's whitespace-nowrap. Added CopyX for "Close Others" and PanelLeftClose for "Close Tabs To The Left".

Applied across all three tab context menus (editor, terminal, browser) — the browser menu had the same two missing icons.

Screenshots

Captured from a dev build of this branch, CDP-attached to this worktree.

Before — wrapped label, two items with no icon:

editor-menu-before.png

After — editor tab menu:

editor-menu-after.png

Terminal and browser tab menus — same treatment:

terminal-menu-after.png
browser-menu-after.png

Measured from the live DOM — all 12 editor items report lines: 1 at a uniform 28px height, each with at least one svg. Move Tab to Split has 2 (leading icon + chevron).

Testing

  • pnpm lint — oxlint + oxfmt clean; verify:localization-catalog verified parity across es/ja/ko/zh
  • pnpm typecheck — tsc --noEmit clean
  • pnpm test — tab-bar suite: 255 passed (35 files)
  • pnpm build — not run; this is a CSS-class + icon change with no build-surface impact, and CI covers it
  • Added tab-context-menu-consistency.test.tsx, asserting every action item has an icon and every menu surface applies the shared sizing rule

I verified the new test fails rather than passing vacuously, against three seeded regressions: removing an icon, cn('w-56', SHARED), and an import left in place while the surface stops using it.

AI Review Report

Reviewed for correctness, cross-platform behavior, and blast radius.

Cross-platform — explicitly checked, since this PR is about width:

  • Shortcut chips flow through formatKeybinding, which emits Ctrl+Alt+W / Ctrl/Alt/Shift on Windows/Linux vs ⌘⌥⇧ glyphs on Mac. Probed against the live menu: with Ctrl+Alt+W the menu grows to 231px and stays single-line.
  • The Reveal in Finder / Open Containing Folder / Reveal in File Explorer label already branches per platform and is unchanged; the longest variant stays on one line.
  • No new metaKey hardcoding, path handling, or shell behavior — the change is CSS classes plus two icon imports.
  • Longest real label measured 364px against an 884px cap at a 900px viewport.

Flagged and addressed: the review noted my first sizing test only checked for the module import and a literal className="w-N", so it would pass on cn('w-56', SHARED). Fixed in a23a523 — it now inspects each DropdownMenuContent/SubContent opening tag directly.

Flagged and assessed as not actionable: a concern that whitespace-nowrap + the viewport cap could clip long labels against the primitives' overflow-x-hidden. I tested this rather than assuming. Clipping requires a ~200-character label; real labels top out at 364px against an 884px cap. Every interpolation in these three menus is either a static translated string or an event handler — there is no user-controlled text in any tab menu label, so the unbounded case can't occur. Adding truncation would trade a real fixed bug for defensive code against an unreachable input. Noted as follow-up below rather than fixed here.

Deliberately scoped out: the whitespace-nowrap is on the tab menus, not the shared DropdownMenuItem primitive. A primitive-level change would hit ~56 usages, some with genuinely unbounded dynamic labels (browser profile names, model descriptions) — a larger cleanup than this bug warrants, and the case where truncation would be the right call.

Security Audit

No security surface. The change is Tailwind class strings and two lucide-react icon imports. No input handling, command execution, path handling, auth, secrets, or IPC changes. No new dependencies. The existing window.api.shell.openPath call in the reveal item is untouched, including its shouldBlockEditorTabLocalOpen guard.

Notes

  • Copy is unchanged, so no new translation keys were needed.
  • Follow-up worth considering separately: menu items with genuinely unbounded dynamic labels elsewhere in the app (browser profile names, model descriptions) have no truncation strategy. Out of scope here.

…icon

The editor tab menu was pinned to `w-48`, so "Close All Editor Tabs" plus its
shortcut chip wrapped onto a second line. This is worse off macOS, where the
chip renders `Ctrl+Alt+W` instead of the much narrower `⌘⌥W`, and in locales
with longer copy.

Size the three tab context menus from a shared rule that grows to fit content
and caps at the viewport, and fill in the icons that "Close Others" and
"Close Tabs To The Left" were missing.
@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Tab context menus now use shared sizing constants for content and submenu surfaces, including single-line rendering and bounded widths. Close-action entries use updated Lucide icons and translation keys. Related test mocks include the new icons, and a consistency test verifies icon presence, shared sizing usage, and width constraints across tab context menu implementations.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.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
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.
Title check ✅ Passed The title clearly matches the main change: tab menus now stay on one line and two missing icons were added.
Description check ✅ Passed The description follows the template and covers summary, screenshots, testing, review, security, and notes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/renderer/src/components/tab-bar/tab-context-menu-consistency.test.tsx (1)

53-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the shared rule is applied to the menu surface itself.

This test only checks that the file imports the sizing module and lacks a literal className="w-N". It will miss regressions such as className={cn('w-56', TAB_CONTEXT_MENU_CONTENT_CLASS)} or an unused import. Assert that each DropdownMenuContent/DropdownMenuSubContent opening tag uses the expected shared constant and inspect width classes within those tags.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d87205e-01fd-4260-9bfd-064b1ca2247f

📥 Commits

Reviewing files that changed from the base of the PR and between 2b244fa and 4490eb8.

📒 Files selected for processing (12)
  • src/renderer/src/components/tab-bar/BrowserTab.test.tsx
  • src/renderer/src/components/tab-bar/BrowserTab.tsx
  • src/renderer/src/components/tab-bar/EditorFileTab.test.tsx
  • src/renderer/src/components/tab-bar/EditorFileTabContextMenu.test.tsx
  • src/renderer/src/components/tab-bar/EditorFileTabContextMenu.tsx
  • src/renderer/src/components/tab-bar/SortableTab.rename-shortcut.test.tsx
  • src/renderer/src/components/tab-bar/SortableTabContextMenu.test.tsx
  • src/renderer/src/components/tab-bar/SortableTabContextMenu.tsx
  • src/renderer/src/components/tab-bar/TabWorkspaceLayoutMenuSection.tsx
  • src/renderer/src/components/tab-bar/TerminalTabSplitMenuSection.tsx
  • src/renderer/src/components/tab-bar/tab-context-menu-consistency.test.tsx
  • src/renderer/src/components/tab-bar/tab-context-menu-sizing.ts

The previous check only looked for the module import and a literal
`className="w-N"`, so it would pass on `cn('w-56', SHARED)` or an import that
nothing uses. Inspect each DropdownMenuContent/SubContent opening tag instead.
@nwparker

Copy link
Copy Markdown
Contributor Author

Good catch — fixed in a23a523.

You were right that the old check was hollow: it only asserted the file imported the sizing module and lacked a literal className="w-N". It now parses each DropdownMenuContent / DropdownMenuSubContent opening tag and asserts that tag applies the expected shared constant (sub-content gets the submenu variant) and carries no fixed width.

I verified it fails rather than passing vacuously, against exactly the two regressions you named:

  • cn('w-56', TAB_CONTEXT_MENU_CONTENT_CLASS) → "<DropdownMenuContent> in SortableTabContextMenu.tsx pins a fixed width"
  • import left in place while the surface stops using it → "<DropdownMenuSubContent> in TabWorkspaceLayoutMenuSection.tsx does not apply TAB_CONTEXT_SUBMENU_CONTENT_CLASS"

Also seeded a removed icon to confirm the icon assertion still catches that. Full tab-bar suite: 255 passing.

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f83099f-f029-48ed-875f-f7b668c91b40

📥 Commits

Reviewing files that changed from the base of the PR and between 4490eb8 and a23a523.

📒 Files selected for processing (1)
  • src/renderer/src/components/tab-bar/tab-context-menu-consistency.test.tsx

Comment on lines +68 to +70
if (surfaces.length === 0) {
return
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not let empty extraction vacuously pass.

If the matcher breaks or a source filename becomes stale, this return makes the consistency test pass without validating any menu surface. Assert that each listed source contains at least one surface, or explicitly allow such files.

Proposed fix
-    if (surfaces.length === 0) {
-      return
-    }
+    expect(surfaces, `No menu surfaces found in ${fileName}`).not.toHaveLength(0)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (surfaces.length === 0) {
return
}
expect(surfaces, `No menu surfaces found in ${fileName}`).not.toHaveLength(0)

Comment on lines +82 to +84
expect(tag, `<${name}> in ${fileName} pins a fixed width:\n${tag}`).not.toMatch(
/(?:^|[\s'"`])w-(?:\d+|\[)/
)

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Match every w-* utility class.

This regex catches only numeric and bracketed widths; w-full, w-auto, w-fit, w-px, and variant-prefixed widths can bypass the test, despite the PR’s stated no-hardcoded-width invariant.

Proposed fix
-        /(?:^|[\s'"`])w-(?:\d+|\[)/
+        /(?:^|[\s'"`])(?:[^\s'"`]*:)*w-[^\s'"`]+/
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
expect(tag, `<${name}> in ${fileName} pins a fixed width:\n${tag}`).not.toMatch(
/(?:^|[\s'"`])w-(?:\d+|\[)/
)
expect(tag, `<${name}> in ${fileName} pins a fixed width:\n${tag}`).not.toMatch(
/(?:^|[\s'"`])(?:[^\s'"`]*:)*w-[^\s'"`]+/
)

@nwparker
nwparker merged commit b59f893 into main Jul 27, 2026
1 check passed
@nwparker
nwparker deleted the nwparker/tab-menu-inconsistancies branch July 27, 2026 08:15
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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