UnderlineNav: Replace dynamic icon visibility logic with hardcoded breakpoints#8133
Merged
Conversation
🦋 Changeset detectedLatest commit: 8909c5a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Replaced dynamic icon visibility with static breakpoints to avoid flickering. Breakpoints customizable via the `hideIconBreakpoint` prop.
This reverts commit 289635d.
jonrohan
reviewed
Jul 7, 2026
Co-authored-by: Jon Rohan <yes@jonrohan.codes>
Co-authored-by: Jon Rohan <yes@jonrohan.codes>
Co-authored-by: iansan5653 <2294248+iansan5653@users.noreply.github.com>
Co-authored-by: iansan5653 <2294248+iansan5653@users.noreply.github.com>
jonrohan
approved these changes
Jul 8, 2026
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.
Fixes #7823
This PR is an alternative approach to #8108 to resolve https://github.com/github/primer/issues/6806.
The problem is that some flickering is inevitable if we want to dynamically hide the icons: we have to let the container overflow in order to detect it and hide the icons, but then when we hide the icons the container no longer overflows. We can minimize flickering but we can never eliminate it with the dynamic approach. Dynamically hiding icons inherently creates an infinite feedback loop.
This PR proposes a simpler, less dynamic alternative: we just hide the icons at hardcoded breakpoints. The breakpoint at which icons are hidden can be controlled by a prop which allows for all the standard Primer breakpoint sizes. The default is very large to avoid breaking existing consumers (namely the global GitHub navigation), but it can easily be reduced by consumers who know they won't be rendering many tabs.
The result is a flicker-free, stable component. However, the drawback is that we sometimes will hide icons early than we would otherwise need to. I think this might be a fair tradeoff.
Also includes some other fixes:
displayinstead ofvisibilityto avoid having to save space for itChangelog
New
Changed
UnderlineNavdynamic icon visibility with static breakpointsRemoved
Rollout strategy
Testing & Reviewing