chore: allow scroll to top on nav side

This commit is contained in:
userquin 2023-02-11 15:42:37 +01:00
parent f3a8778ede
commit db2140e350
2 changed files with 5 additions and 4 deletions

View file

@ -51,7 +51,7 @@ const noUserVisual = computed(() => isHydrated.value && props.userOnly && !curre
:active-class="activeClass"
group focus:outline-none disabled:pointer-events-none
:tabindex="noUserDisable ? -1 : null"
@click="$scrollToTop"
@click="$trackScroll.forceScrollToTop()"
>
<CommonTooltip :disabled="!isMediumOrLargeScreen" :content="text" placement="right">
<div

View file

@ -28,18 +28,19 @@ export default defineNuxtPlugin((nuxtApp) => {
return new Promise<void>((resolve, reject) => {
setTimeout(() => {
if (path !== route.fullPath) {
const fullPath = route.fullPath
if (path !== fullPath) {
reject(new Error('navigation canceled'))
return
}
const r = ignoreCustomRoutes ? undefined : customRoutes.has(route.fullPath)
const r = ignoreCustomRoutes ? undefined : customRoutes.has(fullPath)
if (r) {
reject(new Error('custom routed detected'))
return
}
const scrollPosition = storage.value[route.fullPath]
const scrollPosition = storage.value[fullPath]
if (scrollPosition)
window.scrollTo(0, scrollPosition)