-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
MPA's scroll position restoration behavior: directly position to the previous position when traversing.
When scroll-behavior: auto, navigation API behave the same. But when scroll-behavior: smooth is set, the page will first stay in the same scroll position and then scroll to the previous position with animation.
Worse still, event.scroll() doesn't accept scroll behavior option. So, to cancel this scroll animation, developer need to modify the CSS or fall back to the previous way of handling scrolling, such as recording scrollY in the state.
Reproduction process:
- Open this demo (from chrome doc)
- Set
scroll-behavior: smoothathtmlelement - Make the window small enough to show the scrollbar.
- Navigate back and forth on the page.
2025-03-28.150840.mp4
Metadata
Metadata
Assignees
Labels
No labels