Repository navigation
Scroll Tabs horizontally instead of wrapping - #101
Merged
Merged
Conversation
On narrow screens the tab row now stays on a single line and scrolls horizontally with a hidden scrollbar. The baseline is drawn as an inset shadow on the row so the active underline is not clipped by overflow. A deep-linked active tab is scrolled into view on mount. Adds a `wrap` prop to restore the wrapping behaviour and a `className` prop for the tab row. Closes #100 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #101 +/- ##
==========================================
+ Coverage 95.45% 95.68% +0.23%
==========================================
Files 34 34
Lines 352 371 +19
Branches 124 131 +7
==========================================
+ Hits 336 355 +19
Misses 4 4
Partials 12 12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Drop the unreachable scroll-left branch and ref guard, and add a story without an active tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The baseline colour is read from the `--tabs-baseline` CSS variable, falling back to gray-200 (gray-700 in dark mode), so consumers can recolour or hide it without fighting class order or specificity. - Document that `className` is appended without merging. - Scroll the active tab into view whenever the location changes, not just on mount, so browser back/forward and programmatic navigation work while the tabs stay mounted. Scroll left as well as right. - Measure again once webfonts have loaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
overflow-x: auto on the tab row makes overflow-y compute to auto as well, which clips a focus outline at the top and bottom. Draw the focus-visible state as an inset ring inside the link instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #100
Changes
-mb-pxoverlap with the outer border. The active tab's underline therefore isn't clipped byoverflow-x: auto.--tabs-baselineCSS variable, which falls back to gray-200 (gray-700 in dark mode). The variable can be set on the row or on any ancestor, and covers both light and dark mode.scrollLeftdirectly. This covers deep links, browser back/forward and programmatic navigation while the tabs stay mounted.scrollIntoViewis not used because it would also scroll the page. The position is measured again after webfonts load.wrapprop (defaultfalse) restores the wrapping behaviour.classNameprop adds classes to the tab row. They are appended without tailwind-merge, so they can't reliably override the row's own utilities. The prop documentation says so.Scrollable,NoActiveTab,Wrapping,BackForwardandCustomBaseline, with play-function checks.Migration note for consumers
The bottom border moved from the outer wrapper to the inner row and is now a
box-shadow. CSS such as.dracor-tabs > div { border-bottom: none }no longer has any effect. Use this instead:🤖 Generated with Claude Code