Skip to content

fix: worktree tab overflow - #5415

Merged
AmethystLiang merged 3 commits into
stablyai:mainfrom
tmchow:tmchow/fix-worktree-tab-width
Jun 15, 2026
Merged

AmethystLiang merged 3 commits into
stablyai:mainfrom
tmchow:tmchow/fix-worktree-tab-width

Conversation

@tmchow

@tmchow tmchow commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add shared tab width rules so worktree tabs grow up to a max, then shrink before overflowing
  • add visible tab-strip scrollbar styling plus left/right scroll buttons for non-gesture navigation
  • keep the new-tab button adjacent to the tabs when the strip has spare room
  • harden git-history row timestamp rendering and cover the reported right-sidebar crash path

Demo

Before -- notice how chungus the tabs are and no way to navigate with mouse to see the other tabs that are out of view:

This shows the arrows that appear that make it possible to actually scroll to see out of view tabs:

Tests

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/tab-bar/tab-title-tooltip.test.tsx src/renderer/src/components/tab-bar/TabBar.context-menu.test.ts src/renderer/src/components/tab-bar/BrowserTab.test.tsx src/renderer/src/components/tab-bar/EditorFileTab.test.tsx src/renderer/src/components/tab-bar/SortableTab.rename-shortcut.test.tsx src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx src/shared/git-history-graph.test.ts src/shared/git-history.test.ts
  • pnpm exec oxlint src/renderer/src/components/tab-bar/BrowserTab.tsx src/renderer/src/components/tab-bar/EditorFileTab.tsx src/renderer/src/components/tab-bar/SortableTab.tsx src/renderer/src/components/tab-bar/TabBar.tsx src/renderer/src/components/tab-bar/TabBar.context-menu.test.ts src/renderer/src/components/tab-bar/tab-title-tooltip.test.tsx src/renderer/src/components/tab-bar/tab-strip-overflow-navigation.ts src/renderer/src/components/tab-bar/tab-width-rules.ts src/renderer/src/components/right-sidebar/GitHistoryPanel.tsx src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx src/renderer/src/components/right-sidebar/GitHistoryRow.tsx src/renderer/src/components/right-sidebar/git-history-format.ts
  • node config/scripts/check-styled-scrollbars.mjs
  • pnpm run verify:localization-catalog
  • pnpm run verify:localization-coverage
  • pnpm run typecheck:web
  • git diff --check

@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a0118ff7-4e72-4aeb-bdca-0f1e42a46af8

📥 Commits

Reviewing files that changed from the base of the PR and between cde2f7d and b0877ce.

📒 Files selected for processing (9)
  • src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx
  • src/renderer/src/components/right-sidebar/git-history-format.ts
  • src/renderer/src/components/tab-bar/BrowserTab.tsx
  • src/renderer/src/components/tab-bar/EditorFileTab.tsx
  • src/renderer/src/components/tab-bar/SortableTab.tsx
  • src/renderer/src/components/tab-bar/TabBar.tsx
  • src/renderer/src/components/tab-bar/tab-strip-overflow-navigation.ts
  • src/renderer/src/components/tab-bar/tab-title-tooltip.test.tsx
  • src/renderer/src/components/tab-bar/tab-width-rules.ts

📝 Walkthrough

Walkthrough

The PR introduces a useTabStripOverflowNavigation hook that manages horizontal overflow state, wheel-to-horizontal scrolling, pinned-to-end behavior, and active-tab scroll-into-view for the tab strip. TabBar replaces its inline scroll logic with this hook and gains conditional left/right scroll arrow buttons wired to overflow state. A new tab-width-rules.ts module defines TAB_CONTAINER_WIDTH_CLASSES and TAB_LABEL_WIDTH_CLASSES constants applied across BrowserTab, EditorFileTab, and SortableTab (with data-tab-id attributes added for active-tab targeting). Hidden-scrollbar CSS for .terminal-tab-strip is removed in favor of the scrollbar-sleek approach. In parallel, the inline Git history row UI is extracted from GitHistoryPanel into a standalone GitHistoryRow component backed by a shared formatGitHistoryTimestamp utility, with comprehensive rendering tests added. Locale files gain "Scroll tabs left/right" strings for the new overflow controls.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete. It lacks Screenshots, Testing checklist, AI Review Report with cross-platform verification, Security Audit, and Notes sections required by the template. Add the missing sections: Screenshots (with visual evidence of the fix), completed Testing checklist, AI Review Report confirming cross-platform checks, Security Audit summary, and Notes on platform-specific behavior.
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 (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: worktree tab overflow' directly relates to the main changes in the PR which address tab overflow issues by implementing width rules and scroll navigation.
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.


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
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
src/renderer/src/components/tab-bar/tab-strip-overflow-navigation.ts (1)

181-183: 💤 Low value

Consider using querySelector directly for better performance.

The current approach iterates all [data-tab-id] elements via querySelectorAll then filters with find. A direct attribute selector would be more efficient, especially with many tabs.

♻️ Suggested optimization
-    const activeTab = Array.from(strip.querySelectorAll<HTMLElement>('[data-tab-id]')).find(
-      (candidate) => candidate.getAttribute('data-tab-id') === activeVisibleTabId
-    )
+    const activeTab = strip.querySelector<HTMLElement>(
+      `[data-tab-id="${CSS.escape(activeVisibleTabId)}"]`
+    )

Using CSS.escape ensures the selector remains safe if tab IDs ever contain special characters.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 93885e1b-f90e-466e-8069-4432e0c6388d

📥 Commits

Reviewing files that changed from the base of the PR and between 26121a4 and 1ad41d6.

📒 Files selected for processing (18)
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx
  • src/renderer/src/components/right-sidebar/GitHistoryPanel.tsx
  • src/renderer/src/components/right-sidebar/GitHistoryRow.tsx
  • src/renderer/src/components/right-sidebar/git-history-format.ts
  • src/renderer/src/components/tab-bar/BrowserTab.tsx
  • src/renderer/src/components/tab-bar/EditorFileTab.tsx
  • src/renderer/src/components/tab-bar/SortableTab.tsx
  • src/renderer/src/components/tab-bar/TabBar.context-menu.test.ts
  • src/renderer/src/components/tab-bar/TabBar.tsx
  • src/renderer/src/components/tab-bar/tab-strip-overflow-navigation.ts
  • src/renderer/src/components/tab-bar/tab-title-tooltip.test.tsx
  • src/renderer/src/components/tab-bar/tab-width-rules.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
💤 Files with no reviewable changes (1)
  • src/renderer/src/assets/main.css

Comment thread src/renderer/src/i18n/locales/es.json Resolved
Comment thread src/renderer/src/i18n/locales/ja.json Resolved
Comment thread src/renderer/src/i18n/locales/ko.json Resolved
Comment thread src/renderer/src/i18n/locales/zh.json Resolved
@tmchow tmchow changed the title fix worktree tab overflow fix: worktree tab overflow Jun 15, 2026
@AmethystLiang
AmethystLiang self-requested a review June 15, 2026 21:20
* Move width constraints from tab roots to outer containers to ensure correct sizing and prevent layout breakdown.
* Track a dynamic tab layout signature to recompute overflow navigation boundaries whenever tab states, status, or labels change.
* Handle malformed timestamps in git history formatting to prevent application crashes on invalid or infinite date numbers.
* Remove redundant tooltip titles from the tab bar scroll buttons.
@AmethystLiang
AmethystLiang merged commit 9236ce5 into stablyai:main Jun 15, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix worktree tab overflow

* address tab overflow review feedback

* Fix tab width rules and improve overflow navigation updates

* Move width constraints from tab roots to outer containers to ensure correct sizing and prevent layout breakdown.
* Track a dynamic tab layout signature to recompute overflow navigation boundaries whenever tab states, status, or labels change.
* Handle malformed timestamps in git history formatting to prevent application crashes on invalid or infinite date numbers.
* Remove redundant tooltip titles from the tab bar scroll buttons.

---------

Co-authored-by: Jinjing <[email protected]>
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.

2 participants