storybookjs/storybook
View on GitHubScroll position does not reset when switching between long docs
Open
#12,497 opened on Sep 16, 2020
addon: docsbuggood first issuehelp wantedtriage:reviewed
Description
Describe the bug With multiple pure-documentation MDX docs, the scroll position of the preview window does not reset when switching between docs.
To Reproduce Steps to reproduce the behavior:
- Create at least two MDX docs without stories, with content long enough to result in a scroll bar.
- Select the first doc in the sidebar.
- Scroll down the first document.
- Select the second doc in the sidebar.
The second doc loads with the scroll position already partially down the page.
Expected behavior Selecting a doc should always start with the scroll position at the top of the page.
Screenshots

Code snippets https://github.com/zolk/storybook-mdx-scroll-bug
System: Reproducible in Storybook 6.0.21.