configurable `scrollBehavior`
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v16.11.0
- Nuxt Version:
3.0.0-27267528.292b524
- Package Manager:
npm@8.0.0
- Bundler:
Vite
- User Config:
buildModules
,css
,meta
- Runtime Modules:
-
- Build Modules:
nuxt-windicss@^2.0.3
Describe the bug
scrollBehavior
setting (which is available in Nuxt2) doesn’t work.
I tried both nuxt.config.ts router.scrollBehavior
and putting router.scrollBehavior.js
in project route but they have no effect.
I couldn’t find any document on scrollBehavior at Nuxt3 docs website… Is there any way to make it work?
Reproduction
nuxt.config.ts
import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
// ......
router: {
scrollBehavior: () => ({ x: 0, y: 0 }),
},
})
~/router.scrollBehavior.js
export default () => {
console.log('here') // never called
return { x: 0, y: 0 }
}
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:35 (5 by maintainers)
Top Results From Across the Web
Scroll Behavior | Vue Router
The scrollBehavior function receives the to and from route objects, like Navigation Guards. The third argument, savedPosition , is only available if this...
Read more >ScrollBehavior class - widgets library - Flutter - Dart API docs
Describes how Scrollable widgets should behave. Used by ScrollConfiguration to configure the Scrollable widgets in a subtree. This class can be extended to ......
Read more >scroll-behavior - CSS: Cascading Style Sheets - MDN Web Docs
The scroll-behavior CSS property sets the behavior for a scrolling box when scrolling is triggered by the navigation or CSSOM scrolling APIs ...
Read more >Scroll Behavior Configuration | LivePerson Developer Center
lp_scroll_when_push_notification configures the scroll behavior when open conversation screen by tapping on push notification. LivePerson.
Read more >Add configurable scroll behavior to the Menu component
If another default number of results shown initially is set, we will need to configure this limit to be 10 for TypeaheadSearch. In...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This fix works not so smooth. White blink spoils the impression.
You can set this in a plugin: