Repository navigation
tab: Scroll a clicked tab into view with the next one peeking - #3419
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
linruohan
pushed a commit
to linruohan/gpui-component
that referenced
this pull request
Oct 9, 2026
…idge#3419) ## Description When a `TabBar` overflows, clicking a partially hidden tab selects it but leaves it clipped, so there is no way to keep moving through the strip except by scrolling manually. Clicking a tab (or picking it from the overflow menu) now scrolls it into view with part of the neighboring tab showing, animated with the same spring as the selection indicator. This also works when `track_scroll` is not used. As agreed in longbridge#3021, only a click does this: changing the selection, the tabs or the layout still leaves the offset where the user put it, and a wheel or trackpad scroll during the animation takes over immediately. Reduced motion skips the animation. ## Screenshot | Before | After | | ------ | ----- | | https://github.com/user-attachments/assets/5e189ca9-9a28-446f-ba70-dc229400c5f4 | https://github.com/user-attachments/assets/1ca955cb-f3fe-4cd3-97c9-b50848d70735 | ## How to Test Run `cargo run -- tabs`, add tabs in **Dynamic Tabs** until the bar overflows, then click the clipped tabs at either edge. ## Checklist - [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and followed the guidelines. - [x] Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate. - [x] Passed `cargo run` for story tests related to the changes. - [ ] Tested macOS, Windows and Linux platforms performance (if the change is platform-specific) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a
TabBaroverflows, clicking a partially hidden tab selects it but leaves it clipped, so there is no way to keep moving through the strip except by scrolling manually.Clicking a tab (or picking it from the overflow menu) now scrolls it into view with part of the neighboring tab showing, animated with the same spring as the selection indicator. This also works when
track_scrollis not used.As agreed in #3021, only a click does this: changing the selection, the tabs or the layout still leaves the offset where the user put it, and a wheel or trackpad scroll during the animation takes over immediately. Reduced motion skips the animation.
Screenshot
tabs-before.mp4
tabs-after.mp4
How to Test
Run
cargo run -- tabs, add tabs in Dynamic Tabs until the bar overflows, then click the clipped tabs at either edge.Checklist
cargo runfor story tests related to the changes.