Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky navigation bar #nav-util.is-sticky messes with in-page references #62

Open
mozfreddyb opened this issue Sep 29, 2021 · 0 comments

Comments

@mozfreddyb
Copy link

This comes up in a blog post that has footnotes (Currently in preview, but you might have access? https://blog.mozilla.org/attack-and-defense/?p=246&preview=true#footnote-1):

STR:

  • When clicking a footnote within the document, the browser scrolls to set the linked element to the top
  • This is especially visible when using the "back arrow" from the footnotes to continue reading
  • The nav-util bar is on top of the element that we scrolled to.

According to this answer on stackoverflow, we can fix this by setting the scroll-padding-top on the html element, like so:

html {
  scroll-padding-top: 2.2em; /* height of sticky header */
}

I noticed that stickyness depends on viewport size (mobile and such) and is using scss and I have not used scss. Otherwise I would have provided a pull request right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant