Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/util/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ function scrollToPosition (shouldScroll, position) {
}

if (position) {
window.scrollTo(position.x, position.y)
// $flow-disable-line
if ('scrollBehavior' in document.documentElement.style) {
window.scrollTo({
left: position.x,
top: position.y,
// $flow-disable-line
behavior: shouldScroll.behavior
})
} else {
window.scrollTo(position.x, position.y)
}
}
}
2 changes: 1 addition & 1 deletion types/router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export interface NavigationFailure extends Error {
}

type Position = { x: number; y: number }
type PositionResult = Position | { selector: string; offset?: Position } | void
type PositionResult = Position | { selector: string; offset?: Position, behavior?: ScrollBehavior } | void

export interface RouterOptions {
routes?: RouteConfig[]
Expand Down