Files
gitbook/packages
Claude 06132fe0f0 Own scroll-on-navigation instead of Next's default, so cross-page anchors land on target (RND-11844)
The first attempt (re-running useScrollToHash on `pathname`) had no effect: the
root-layout `ScrollPage` hook already called `scrollToHash` on every hash+pathname
change, so the scroll was firing — but Next's own default post-navigation scroll
(App Router hash handling is unreliable, see useHash / vercel/next.js#49465) runs
after it and scrolls to top, overriding us. Same-page anchors are unaffected because
Link.tsx handles those manually with preventDefault (no NextLink scroll), and direct
URL loads work via the browser's native hash scroll — which matches the reported
behavior.

Set `scroll={false}` on the internal NextLink so Next stops managing scroll on
client-side navigations; GitBook's ScrollPage then owns it (scroll to the hash when
present, else to the top). Revert the redundant `pathname` dependency added in the
previous commit.

Not verified in a browser: this sandbox's network policy blocks the preview
deployment and the GitBook API, so it needs a browser check on a site with
cross-page anchor links (e.g. n8n) plus a regression pass on ordinary navigation
scroll-to-top and back/forward restoration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpGe6QkAF4Y1HDGUD4vbke
2026-07-14 10:58:34 +00:00
..
2026-02-25 11:37:48 +01:00
2025-10-15 13:30:24 +02:00
2026-07-06 12:52:44 +00:00
2026-05-19 13:24:41 +02:00
2026-07-06 12:52:44 +00:00