Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix scroll jump and scroll reset #3756

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

Conversation

@gregberge
Copy link
Contributor

@gregberge gregberge commented Oct 25, 2025

  • Remove useless Suspense boundary
  • Fix scroll not reset when navigating pages
  • Fix scroll jump on page load

Copy link

linear bot commented Oct 25, 2025

Copy link

changeset-bot bot commented Oct 25, 2025

⚠️ No Changeset found

Latest commit: 17b6f2a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes scroll behavior issues during page navigation by preventing scroll position persistence and eliminating scroll jumps on initial page load. The changes refactor scroll handling logic to use a custom hook and improve scroll-to-element functionality.

  • Extracted scroll event handling into a reusable useScrollListener hook
  • Added checks to prevent scroll behavior on initial page load (only trigger on navigation)
  • Replaced scrollIntoView with custom scroll positioning logic for better control

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/gitbook/src/components/primitives/ScrollContainer.tsx Refactored scroll event handling to use useScrollListener hook and replaced scrollIntoView with custom scrollToElementInContainer function
packages/gitbook/src/components/hooks/useScrollPage.ts Added guard to prevent scroll behavior on initial page load by checking for previous state
packages/gitbook/src/components/SitePage/SitePage.tsx Removed unnecessary React.Suspense boundary around PageClientLayout

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gregberge gregberge changed the title (削除) greg/rnd 8498 scrolly persists on page change instead of starting at the (削除ここまで) (追記) Fix scroll jump and scroll reset (追記ここまで) Oct 25, 2025
Copy link

argos-ci bot commented Oct 25, 2025
edited
Loading

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2 (Inspect) ✅ No changes detected - Oct 25, 2025, 8:28 AM
v2-cloudflare (Inspect) ✅ No changes detected - Oct 25, 2025, 8:31 AM
v2-vercel (Inspect) ✅ No changes detected - Oct 25, 2025, 8:31 AM

@gregberge gregberge enabled auto-merge (squash) October 25, 2025 08:34
@gregberge gregberge merged commit a2fb627 into main Oct 25, 2025
16 checks passed
@gregberge gregberge deleted the greg/rnd-8498-scrolly-persists-on-page-change-instead-of-starting-at-the branch October 25, 2025 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments

@viktorrenkema viktorrenkema viktorrenkema approved these changes

@zenoachtig zenoachtig Awaiting requested review from zenoachtig

@SamyPesse SamyPesse Awaiting requested review from SamyPesse

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /