Minimal standalone Next.js app for checking hash-handling behavior with the same framework versions used by the docs app:
next:16.2.6react:19.2.4react-dom:19.2.4
cd /Users/timonreyturak/Documents/GitHub/next-link-hash-repro
npm installnpm run devOpen:
http://localhost:3100/#section-a
npm run build
npm run startOpen:
http://localhost:3100/#section-a
- Open
/#section-adirectly. - Click
Next hash link to section B. - Watch the URL debugger and the browser URL.
Expected healthy behavior:
- URL becomes
/#section-b - event log should show either a single
hashchangeor a singlepushState/replaceStateto the new fragment, but not a doubled fragment
- Open
/#section-adirectly. - Click
Go to other page with Next pathname string. - Click
Back home with Next pathname string. - Repeat with
Next pathname object.
Expected healthy behavior:
- returning to
/should not silently restore#section-aunless the clicked link explicitly includes that hash
The docs app reproduces the issue only in deployed production Chromium right now. This app isolates next/link from the docs codebase so you can compare:
next devnext build && next start- local versus deployed environments
next/linkversus native anchor behavior
Observed locally on 6 July 2026 in Chromium with this minimal app:
npm run dev: no duplicate fragment and no stale fragment restoration in the tested flowsnpm run build && npm run start:next/linkreproduces both issues- starting at
/#section-a, clickingNext hash link to section Bproduces/#section-a#section-b - starting at
/#section-a, going to/otherwithnext/linkand returning withnext/linkrestores/#section-a
- starting at
- native anchors remain healthy in the same local production run
Native hash link to section Bbecomes/#section-b- native navigation back to
/returns/without restoring the stale fragment
Use this before sharing the repro outside your machine.
- Initialize a standalone git repo in
/Users/timonreyturak/Documents/GitHub/next-link-hash-repro. - Replace absolute local paths in documentation with a public repository URL.
- Confirm
README.mdonly referencesnpm install,npm run dev,npm run build, andnpm run start. - Run
npm installfrom a clean checkout to ensurepackage-lock.jsonis valid. - Run
npm run buildandnpm run start, then repeat both repro flows once more. - Capture one screenshot or screen recording of
/#section-a#section-bin production mode. - Paste the contents of
NEXT_ISSUE_GITHUB.mdinto the upstream Next.js issue. - Link the public repro repository in the issue body.