GitbookIO / GitbookIO/gitbook

scrollY persists on page change instead of starting at the top

Open
#3,755 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
29k
Forks
4k
Avg merge
1d 2h
Merged PRs (30d)
71

Description

Issue Description

When I click from one page to another, the scrollY value persists, and I'll start at the middle of another page instead of the top. I'm not sure if it fully qualifies as a bug, but I've noticed it happens both on my site and other Gitbook sites I've visited.

Steps to Reproduce

  1. Navigate to a page
  2. Scroll down anywhere
  3. Navigate to another page, end up in the middle

Example

This example is from another GitBook site:

https://github.com/user-attachments/assets/5826b67c-ba02-4971-97f6-09e966357f07

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported navigation flow: open a page, scroll down, then navigate to another page and observe the scroll position. Trace the page-change handling that controls scroll restoration; done means the destination page consistently opens at the top, including the reported GitBook-site scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.