/** * Handles the scroll behavior on route navigation * * @param {object} to Route object of next page * @param {object} from Route object of previous page * @param {object} savedPosition Used by popstate navigations * @returns {(object|boolean)} Scroll position or `false` */// @ts-ignoreexport async function scrollBehavior(to, from, savedPosition) {
// Returning the `savedPosition` (if available) will result in a native-like // behavior when navigating with back/forward buttons if (savedPosition) { return { ...savedPosition, behavior }; } // Scroll to anchor by returning the selector if (to.hash) { return { el: decodeURI(to.hash), behavior }; } // Check if any matched route config has meta that discourages scrolling to top