-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Open
Labels
Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.Related to Next.js linking (e.g., <Link>) and navigation.
Description
🐛 Bug: <Link href="/" /> does not scroll to top on same-route navigation
Description
In Next.js 14, clicking a <Link href="/" /> while already on the / route correctly scrolls the page back to the top.
After upgrading to Next.js 16.1.1, this behavior no longer works. The scroll position is preserved, and the page does not move to the top.
This appears to be a regression or an undocumented change in scroll restoration behavior.
Link to the code that reproduces this issue
https://github.com/Kaushik7984/scroll-bug-repro
To Reproduce
import Link from "next/link";
export default function Page() {
return (
<div>
<div style={{ height: "200vh" }}>Scroll down</div>
<Link href="/">Go Home</Link>
</div>
);
}
- Steps to reproduce:
- Visit /
- Scroll down
- Click the Go Home link
- Page does not scroll to top
Current vs. Expected behavior
Expected Behavior
Clicking a link pointing to the current route (e.g. <Link href="/" /> when already on /) should scroll the page to the top, matching the behavior in Next.js 14.
Actual Behavior
In Next.js 16.1.1:
- Clicking
<Link href="/" />while already on/ - Does not scroll to the top
- Scroll position remains unchanged
Provide environment information
### Environment
- **Next.js version:** 16.1.1
- **React version:** 19.2.3
- **React DOM version:** 19.2.3
- **Router:** App Router
- **Node.js:** 20.x
- **Package manager:** pnpm
- **OS:** Windows 11
- **Browser:** Chrome
---
### `package.json`
{
"name": "scroll-bug-repro",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
},
"dependencies": {
"next": "16.1.1",
"react": "19.2.3",
"react-dom": "19.2.3"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "16.1.1",
"tailwindcss": "^4",
"typescript": "^5"
}
}Which area(s) are affected? (Select all that apply)
Linking and Navigating
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
Additional Context
- This behavior worked correctly in Next.js 14 without any custom scroll handling.
- The issue occurs when navigating to the same route (
/ → /) using<Link />. - This is commonly needed for persistent navigation UIs such as:
- Bottom navigation bars
- Dock-style navigation
- Fixed headers / footers
- The navigation component remains mounted between navigations.
- Setting
scroll={true}on<Link />does not restore the previous behavior. - Manually calling
window.scrollTo(0, 0)resolves the issue but feels like a workaround. - No related breaking change or migration note was found in the Next.js 15/16 documentation.
This makes it difficult to implement expected UX patterns where re-clicking the active route should reset scroll position.
sitarass and Chibuike-web
Metadata
Metadata
Assignees
Labels
Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.Related to Next.js linking (e.g., <Link>) and navigation.