Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/heavy-brooms-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Fix `UnderlineNav` items all being considered overflowing on Safari with text size overrides
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function OverflowObserverProvider({
for (const cb of callbacks) cb(isOverflowing)
}
},
{root, threshold: [0, 1]},
{root, threshold: [0, 0.95]},
)
observerRootRef.current = root
return observerRef.current
Expand Down Expand Up @@ -112,12 +112,12 @@ export function OverflowObserverProvider({
}

/**
* Treat any target that is not fully visible within the observer root as overflowing. Wrapped items should be fully
* clipped (`isIntersecting: false`, `intersectionRatio: 0`), but partial ratios also count as overflowing to guard
* against sub-pixel boundary cases.
* 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 +115 to +117
*/
function getIsOverflowing(entry: Pick<IntersectionObserverEntry, 'intersectionRatio' | 'isIntersecting'>) {
return !entry.isIntersecting || entry.intersectionRatio < 1
return !entry.isIntersecting || entry.intersectionRatio < 0.95
Comment on lines 119 to +120
}

function supportsIntersectionObserver() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
border-radius: var(--borderRadius-medium);
max-width: 100%;
margin-bottom: var(--base-size-8);
height: 32px;
height: var(--base-size-32);

/* button resets */
appearance: none;
Expand Down
Loading