Skip to content

Commit

Permalink
fix(docs): add scroll-margin-start to PageTabs (#4406)
Browse files Browse the repository at this point in the history
Co-authored-by: Heather Buchel <[email protected]>
  • Loading branch information
hbuchel and Heather Buchel authored Sep 21, 2023
1 parent b3f4b6c commit edf19f4
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions docs/src/styles/docs/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@
}

// Targeting tabs
& > [data-orientation] > [role='tabpanel'] {
padding-top: var(--amplify-space-medium);
// Don't add top margin to h2's since they already
// have top margin
& > * + *:not(h2) {
margin-top: var(--amplify-space-medium);
& > [data-orientation] {
& > [role='tablist'] button {
// 20rem is kind of magic here; it's at least the height of the page above the page tabs.
// Since we add a scroll-margin-block-start to tabpanel below, we need to add
// this here to scroll the top of the page when reverse keyboard navigating
// so elements aren't hidden by sticky nav.
scroll-margin-block-start: 20rem;
}
& > [role='tabpanel'] {
// Prevent demo from getting cut off by sticky nav
// when keyboard navigating.
scroll-margin-block-start: 7rem;
padding-top: var(--amplify-space-medium);
// Don't add top margin to h2's since they already
// have top margin
& > * + *:not(h2) {
margin-top: var(--amplify-space-medium);
}
}
}

Expand Down

0 comments on commit edf19f4

Please sign in to comment.