-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
docs(gatsby-react-router-scroll): Add documentation for scroll restoration options #25450
Conversation
docs/docs/reach-router-and-gatsby.md
Outdated
@@ -11,6 +11,7 @@ The main reasons Gatsby uses `@reach/router` are: | |||
1. Preloading. You can read more about preloading in the docs for the [Gatsby Link API](https://www.gatsbyjs.org/docs/gatsby-link/). | |||
2. The [routing accessibility](https://reach.tech/router/accessibility) it provides. | |||
3. It supports [server rendering](https://reach.tech/router/server-rendering) which helps Gatsby build routed files at build time. | |||
4. Scroll restoration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably have a full sentence with a link to learn more, like the other list items. I wouldn't necessarily expect all (or even most?) of the people reading this know what scroll restoration is. What does using scroll restoration let us do? The link could be to the Reach docs or just the relevant section below.
4. Scroll restoration. | |
4. It supports [scroll restoration](), which allows Gatsby to better control pages' scroll position. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change, but I don't really know what to link to. Maybe this? https://reacttraining.com/react-router/web/guides/scroll-restoration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry! Yes, that's exactly what I meant by "Reach docs". That was, in no way, clear. 😳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw that's react router docs. Reach doesn't have a section on scroll restoration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That... is true. It is the page I was thinking of, regardless. 😅
Co-authored-by: Aisha Blake <[email protected]>
Your pull request can be previewed in Gatsby Cloud: https://build-66bc3ec4-397c-4d59-9429-dc357b179644.staging-previews.gtsb.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Description
Adds
useScrollRestoration
to main exports fromgatsby
Adds a small intro to our scroll restoration. Turns out we weren't documenting these anywhere.
Clubhouse ticket: https://app.clubhouse.io/gatsbyjs/story/9575/add-documentation-for-usescrollrestoration
Documentation
Related Issues
#24306