Skip to content

Use base-size-32 instead of hardcoded 32px for item height#8188

Open
iansan5653 wants to merge 3 commits into
mainfrom
fix-underlinenav-item-height
Open

Use base-size-32 instead of hardcoded 32px for item height#8188
iansan5653 wants to merge 3 commits into
mainfrom
fix-underlinenav-item-height

Conversation

@iansan5653

Copy link
Copy Markdown
Contributor

The underline nav item height is hardcoded at 32px. This means that when the font size changes (ie, "Make text smaller" in Safari), the item height doesn't respect the new font size. But the container does, because it has max-height: var(--control-xlarge-size) which is font-size dynamic. This causes the container to clip all the items by having a smaller height than they can fit in, which treats them all as overflowing.

The fix is simple, we can just use --base-size-32 instead.

However, this still doesn't work perfectly. On sufficiently large font sizes (+3 zoom levels), the pixel-perfect accuracy of the sizes just isn't calculated quite right, and so the items still overflow even though they seem fully visible. I think this is a safari issue and there's not much we can do about it except to make the overflow logic slightly more forgiving, allowing up to 5% of an item to be clipped before hiding it.

Changelog

Changed

  • Fixes UnderlineNav items all being considered overflowing on Safari with font size overrides

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 29cfb51

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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

@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. If this doesn't work, you can also use the original workflow here. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

Fixes an issue with `UnderlineNav` items overflowing in Safari due to text size overrides.
@iansan5653
iansan5653 marked this pull request as ready for review July 17, 2026 17:40
@iansan5653
iansan5653 requested a review from a team as a code owner July 17, 2026 17:40
@github-actions
github-actions Bot requested a deployment to storybook-preview-8188 July 17, 2026 17:44 Abandoned

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts UnderlineNav overflow behavior to better handle Safari text size overrides by aligning tab item sizing with Primer tokens and making overflow detection more tolerant of minor clipping.

Changes:

  • Replaced a hardcoded 32px height with var(--base-size-32) for underline nav items.
  • Relaxed overflow detection to allow up to 5% clipping (intersectionRatio threshold from 1 to 0.95).
  • Added a patch changeset describing the Safari overflow fix.
Show a summary per file
File Description
packages/react/src/internal/components/UnderlineTabbedInterface.module.css Uses --base-size-32 instead of a hardcoded 32px for underline item height.
packages/react/src/internal/components/OverflowObserverProvider.tsx Makes overflow detection less strict (0.95 threshold) to reduce false positives from layout rounding issues.
.changeset/heavy-brooms-wash.md Patch changeset entry for the UnderlineNav Safari overflow behavior fix.

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Low

}
},
{root, threshold: [0, 1]},
{root, threshold: [0, 0.95]},
Comment on lines +115 to +117
* Treat any target that is not fully visible within the observer root as overflowing. Unwrapped items should be fully
* visible, but in some scenarios the layout isn't perfectly accurate (ie, in Safari with extra-large text size) so we
* allow for up to 5% to be clipped before hiding the item.
Comment on lines 119 to +120
function getIsOverflowing(entry: Pick<IntersectionObserverEntry, 'intersectionRatio' | 'isIntersecting'>) {
return !entry.isIntersecting || entry.intersectionRatio < 1
return !entry.isIntersecting || entry.intersectionRatio < 0.95
@iansan5653

iansan5653 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Confirmed working in storybook on every text size

Screen.Recording.2026-07-17.at.2.00.17.PM.mov

@primer-integration

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants