Uh oh!
There was an error while loading. Please reload this page.
UnderlineNav: Replace dynamic icon visibility logic with hardcoded breakpoints - #8133
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 |
|
Replaced dynamic icon visibility with static breakpoints to avoid flickering. Breakpoints customizable via the `hideIconBreakpoint` prop.
This reverts commit 289635d.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Jon Rohan <yes@jonrohan.codes>
Co-authored-by: Jon Rohan <yes@jonrohan.codes>
Uh oh!
There was an error while loading. Please reload this page.
Fixes#7823
This PR is an alternative approach to #8108 to resolvehttps://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