bug: Scroll position resets to top after navigating back from week detail page
Describe the bug
When navigating into a week’s section (e.g., Week 8 - Offline → Mongo Deep Dive) and then going back to the main course page, the page always scrolls back to the top instead of restoring the previous scroll position.
To Reproduce
- Go to the course page with the list of weeks (e.g., /courses/14).
- Scroll down to any section (e.g., Week 8).
- Click on the week (e.g., Week 8 - Offline).
- Press the browser’s back button or click back to return to the main page.
- Notice that the page reloads and scrolls to the top instead of staying at the previous scroll position.
Expected behavior
When going back to the main course page, it should restore the previous scroll position so the user sees the same section they were on before navigating.
Screenshots or GIFs
(Attached above)
Info
- Browser: Chrome, Brave
- Version: Latest stable versions (Chrome 140.x, Brave 1.72.x)
Additional context
This affects usability because users must scroll again to find their place. Implementing scroll position restoration (window.history.scrollRestoration = "manual" or saving/restoring scroll position with sessionStorage) should solve this issue.
Hey @nitingupta95 can I work on this? I was also experiencing the same bug, and it's really frustrating.
Hello 👋 @devsargam I’m interested in fixing this issue. I’ll implement scroll restoration for the course content page to improve navigation UX. Please assign me if possible.