storybookjs/storybook

Scroll position does not reset when switching between long docs

Open

#12,497 创建于 2020年9月16日

在 GitHub 查看
 (11 评论) (2 反应) (1 负责人)TypeScript (89,909 star) (10,058 fork)batch import
addon: docsbuggood first issuehelp wantedtriage:reviewed

描述

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:

  1. Create at least two MDX docs without stories, with content long enough to result in a scroll bar.
  2. Select the first doc in the sidebar.
  3. Scroll down the first document.
  4. 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 Screen Recording 2020-09-16 at 14 57 46

Code snippets https://github.com/zolk/storybook-mdx-scroll-bug

System: Reproducible in Storybook 6.0.21.

贡献者指南