Repository navigation
fix(tab-bar): keep the active tab visible when the tab strip scrolls - #24010
Conversation
Makes the current tab easier to locate in many-tab scenarios. The active tab now sticks to a viewport edge via sticky positioning when it would scroll out of view, with a full-foreground indicator bar for better visibility and arrow animation when a background tab opens off-screen.
When a background tab opens beyond the visible area, automatically scroll to reveal it (unless hovering the tab strip). This replaces the previous arrow-nudge animation with direct visibility. revealTabStripElement now handles keeping the active tab visible alongside the revealed tab when both fit, or docks the active tab when needed.
Detect opened tabs by comparing tab identities independently of count changes. Newly opened tabs are now revealed even when the total tab count stays the same—e.g., when a tab closes as another opens.
Replace count-based tab detection with identity tracking so the strip correctly reveals tabs when they're added, replaced, or when the active tab closes and switches to a far-back history tab. Removes the tabCount parameter and simplifies overflow navigation by using identity sets.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (19)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughTab components now expose slot identities and apply active-tab docking when no drag is in progress. Overflow navigation tracks slot changes, reports the active dock side, and reveals off-screen tabs using slot geometry. The tab-strip surface adjusts its scroll fades for the docked edge. The active drop marker and the docked-end tab seam also have updated styling. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The change keeps active tabs visible and makes overflow navigation slot-aware. No concrete merge-blocking issue is established; it is ready to merge subject to normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 36.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 18 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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.
ℹ️ Minor suggestions only.
Reviewed changes
- Active tab docks to strip edges. New
use-tab-strip-slot-props.tsmarks each tab's direct strip child withdata-tab-strip-slotand tags the active one withdata-active-tab-dockplussticky inset-x-0 z-10, wired intoSortableTab,BrowserTab,EditorFileTab, andClientHostedBrowserTab. - New slot-geometry module.
tab-strip-slot-geometry.tsreconstructs each slot's natural span, reports the docked edge, finds newly opened offscreen slots, and implements a least-distancerevealTabStripSlot. - Open/close tracked by identity.
tab-strip-overflow-navigation.tsdropstabCountin favor of slot-id sets, suppresses the reveal on a close commit viatabClosedThisCommitRef, skips revealing while the pointer hovers the strip, and exposesactiveTabDockSide. - Presentation. Active indicator is now full
bg-foreground; the edge fade is dropped on the docked side; a::beforeseam is added fordata-active-tab-docked='end'; theTabBarlayout key now includes client-hosted row ids.
ℹ️ The new geometry module and the docking class have no direct tests
tab-strip-slot-geometry.ts and use-tab-strip-slot-props.ts are covered only indirectly. tab-strip-growth-scroll.test.tsx builds its own slots and mocks getBoundingClientRect to clamp a data-active-tab-dock element into the viewport, and the component tests mock useTabStripSlotProps to a stub that drops the sticky inset-x-0 classes. As a result, the actual docking mechanism (the CSS class) and the span/offscreen math against a real layout are unverified — deleting sticky inset-x-0 would leave every test green. I confirmed the sticky + inset-x-0 behavior in Chromium, so the mechanism is sound; the gap is that a future regression would not be caught.
Technical details
# Docking has no regression guard
## Affected sites
- `src/renderer/src/components/tab-bar/tab-strip-slot-geometry.ts` — no dedicated test.
- `src/renderer/src/components/tab-bar/use-tab-strip-slot-props.ts` — the `sticky inset-x-0 z-10` class is not asserted anywhere; `BrowserTab.test.tsx`, `EditorFileTab.test.tsx`, and `SortableTab.rename-shortcut.test.tsx` mock the hook, and `tab-strip-growth-scroll.test.tsx` hand-builds slots.
- `src/renderer/src/assets/main.css` — the end-dock seam and fade suppression are not exercised.
## Required outcome
- At least one guard that fails if the active slot stops carrying the docking class, or an E2E/manual check of both-edge docking, the edge fade, and the seam.
## Suggested approach (optional)
- Assert the `className`/`data-active-tab-dock` output of `useTabStripSlotProps` for active vs inactive vs dragging.
- Consider a small unit test for `getSlotNaturalSpan`/`getSlotOffscreenSide`/`revealTabStripSlot` with real rects.ℹ️ Nitpicks
- The PR body is still the empty template: no ELI5, What Changed, Why, Testing, or required before/after visual proof for a UI behavior change.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
When a background tab opens while the pointer hovers the tab strip, defer its reveal until the pointer leaves. This prevents the active tab from sliding away mid-interaction. Also support client-hosted rows taking active state while maintaining tab dock positioning.
| const knownIds = new Set([...readTabStripSlotIds(el)].filter((id) => !deferred.has(id))) | ||
| const offscreenOpened = findOffscreenOpenedTabStripSlot(el, knownIds) | ||
| if (!offscreenOpened) { | ||
| return | ||
| } | ||
| revealTabStripSlot(el, offscreenOpened) |
There was a problem hiding this comment.
Deferred reveal overrides selection When a background tab opens while the pointer is over the strip, its reveal is queued. If the user then selects another tab with the keyboard, leaving the strip still reveals the earlier background tab. This moves the strip away from the selected tab; the queued reveal should be cleared or reconsidered when selection changes.

ELI5
With lots of tabs open, the tab bar scrolls sideways, and the tab you're on can scroll out of sight. Then it's hard to tell which tab you're looking at. Now the current tab sticks to the edge of the tab bar instead of disappearing, and its underline is easier to see.
What Changed
Before: with many tabs, every tab shrinks to 72px and the strip scrolls. The active tab was marked only by a 6% background tint and a 60%-grey underline, which is hard to spot among many similar tabs. Once you scrolled it out of view, nothing pointed back to it. A tab opened in the background could land out of view with no visible change. Closing the active tab could send the strip to a far-away tab and back.
After:
position: stickyon each tab's wrapper in the strip (use-tab-strip-slot-props.ts). Docking turns off during a drag, because drop targets are picked from on-screen positions and a docked tab overlaps its neighbour.scrollIntoViewand the scroll anchor would be fooled. They now use where the tab sits in the tab order, not where it's drawn (tab-strip-slot-geometry.ts).Why
Chrome shrinks tabs down to their icons and never scrolls. That works because every website has its own favicon. Orca's terminals and editor files share icons, so icon-only tabs would all look the same.
VS Code scrolls and reveals the tab you switch to, but loses the active tab as soon as you scroll by hand.
I also prototyped counts on the scroll arrows, a marker on the scroll thumb, and an all-tabs list. Each of those points you toward the tab instead of showing it. Docking keeps the active tab visible in every state with one CSS rule; the rest of this PR keeps scrolling correct around it. I dropped keeping the active tab at full width, because resizing tabs on click moves the other tabs under the cursor.
Linked Issue
No existing issue covers this bug.
Visual Proof
The active tab (
bun-notes.md) docked on the right after scrolling the strip back to the start:A background tab opened far from the active tab. The strip scrolls to the new tab ("New Tab", right edge), and the active tab (
orb-notes.md) docks on the left:Testing
Unit tests in
tab-strip-growth-scroll.test.tsxcover:Each test was checked to fail with its fix removed.
tab-strip-scroll-metricsanddrop-indicatortests were updated too.Dev build on macOS, a hidden window driven over the DevTools protocol, with 24+ tabs. Checked:
Checks on this branch: 821 tab-bar/tab-group/floating-terminal tests,
pnpm tc:web, oxlint on changed files, and the changed-code quality gate all pass.Not yet tested:
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)