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" :active-class="activeClass"
group focus:outline-none disabled:pointer-events-none group focus:outline-none disabled:pointer-events-none
:tabindex="noUserDisable ? -1 : null" :tabindex="noUserDisable ? -1 : null"
@click="$scrollToTop" @click="$trackScroll.forceScrollToTop()"
> >
<CommonTooltip :disabled="!isMediumOrLargeScreen" :content="text" placement="right"> <CommonTooltip :disabled="!isMediumOrLargeScreen" :content="text" placement="right">
<div <div

View file

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