Skip to content
Discussion options

You must be logged in to vote

Gatsby should update the DOM to include the main-navigation--scrolled class.

Why would you expect this? You're only setting the class name when scrolling, when Gatsby creates the HTML it doesn't scroll anything. You can either have the class name on the element in the HTML or not, but not both things. A former colleague wrote a great article about this: https://joshwcomeau.com/react/the-perils-of-rehydration/

So similar to libraries like react-headroom you need to handle the case of reloading the page when not at the top of the page yourself and add the logic to change the navigation then.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LandonSchropp
Comment options

Answer selected by LekoArts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #28076 on November 16, 2020 06:51.