-
Notifications
You must be signed in to change notification settings - Fork 18
Fix scrolling when navigating between pages on the documentation site. #2313
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
base: master
Are you sure you want to change the base?
Conversation
Mil4n0r
left a comment
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.
No changes are required in _app or MainContent.
MainContent is causing this problem because it is part of the ApplicationLayout itself, and it is the one handling the scroll, not ApplicationLayout.Main. the thing is that we would need to have a ref to it (instead of an id).
By having the current useRef from ApplicationLayout pointing the MainContent instead of the whole content, we would be able to add inside the same file something like this:
useEffect(() => {
if (ref.current) {
ref.current.scrollTop = 0;
}
}, [children]);
We should discuss it with @Jialecl to make sure it does not break anything though.
|
LGTM, let's wait for @Jialecl to confirm though. |
|
This approach messes with the navigation to different sections. For example: if you navigate to a link that looks like https://(,,,).com/(...)/#intro it won't scroll to #intro |
Checklist
(Check off all the items before submitting)
/libdirectory./websiteas needed.Purpose
Scroll to Top when we switch from when page to another