Skip to content

Commit 775e640

Browse files
authored
Fix SubNav layout shift Safari bug (#1072)
* fix layout shift * style tweak * update snapshots * add changeset * visual alignment * remove comment
1 parent afd46c1 commit 775e640

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.changeset/clean-cobras-knock.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react-brand': patch
3+
---
4+
5+
Fixed a bug in the `SubNav` component where the separator could appear on a new line during initial render in Safari.

packages/react/src/SubNav/SubNav.module.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,13 +536,23 @@
536536
display: none;
537537
}
538538

539+
.SubNav__container--with-anchor-nav .SubNav__heading {
540+
padding-block-end: 1px;
541+
}
542+
539543
.SubNav__heading {
540544
font-size: calc(var(--base-size-20) - 2px);
541545
line-height: var(--base-size-24);
542546
}
543547

544548
.SubNav__heading-separator {
545549
margin-inline-end: var(--base-size-20);
550+
display: inline-flex;
551+
top: 0;
552+
}
553+
554+
.SubNav__container--with-anchor-nav .SubNav__heading-separator {
555+
top: -1px;
546556
}
547557

548558
.SubNav--header-container-outer {
@@ -554,6 +564,11 @@
554564
margin-inline-end: var(--base-size-20);
555565
}
556566

567+
.SubNav__header-container {
568+
display: flex;
569+
align-items: center;
570+
}
571+
557572
.SubNav__subHeading {
558573
font-size: var(--brand-text-size-100);
559574
line-height: var(--brand-text-lineHeight-100);

0 commit comments

Comments
 (0)