Skip to content

Commit

Permalink
Local Navigation Bar: Update scroll offset to prevent local nav bar o…
Browse files Browse the repository at this point in the history
…verlapping content (#597)

* Local Navigation Bar: Update scroll offset to prevent local nav bar overlapping content

* Use a small offset `scroll-margin-top` for TOC headings
  • Loading branch information
ryelle authored Apr 15, 2024
1 parent 288f29c commit fa5e370
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions mu-plugins/blocks/local-navigation-bar/postcss/style.pcss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Set up the custom properties. These can be overridden by settings in theme.json. */
:where(body) {
:where(html) {
--wp--custom--local-navigation-bar--spacing--height: 60px;
}

Expand Down Expand Up @@ -318,8 +318,7 @@
}

@media (min-width: 890px) {
/* stylelint-disable selector-id-pattern */
#wp--skip-link--target {
scroll-margin-top: var(--wp--custom--local-navigation-bar--spacing--height, 0);
html {
scroll-padding-top: calc(var(--wp--custom--local-navigation-bar--spacing--height, 0px) + var(--wp-admin--admin-bar--height, 0px));
}
}
2 changes: 1 addition & 1 deletion mu-plugins/blocks/table-of-contents/postcss/style.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@

@media (min-width: 890px) {
.is-toc-heading {
scroll-margin-top: calc(var(--wp--custom--local-navigation-bar--spacing--height) + var(--wp--preset--spacing--20));
scroll-margin-top: var(--wp--preset--spacing--20);
}
}

0 comments on commit fa5e370

Please sign in to comment.