Skip to content

Commit 2e6301a

Browse files
fix: scroll top missing on search
1 parent 33c43ee commit 2e6301a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/router.options.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ export default {
77
return savedPosition
88
}
99

10-
// If only query parameters changed (same path), don't scroll
10+
// Scroll to top when main search query changes
11+
if (to.path === '/search' && to.query.q !== from.query.q) {
12+
return { left: 0, top: 0 }
13+
}
14+
15+
// Don't scroll for other param changes (filters, pagination, etc.)
1116
if (to.path === from.path) {
1217
return false
1318
}

0 commit comments

Comments
 (0)