diff --git a/frontend/src/components/Sidebar.vue b/frontend/src/components/Sidebar.vue index c794029f5..287ac0283 100755 --- a/frontend/src/components/Sidebar.vue +++ b/frontend/src/components/Sidebar.vue @@ -61,13 +61,21 @@ const handleScroll = (e) => { lastScrollY = currentScrollY <= 0 ? 0 : currentScrollY; } -onMounted(() => { - // Listen to scroll events during the capture phase to track child scrolling (like TutorialView) - window.addEventListener('scroll', handleScroll, true); -}) +const toggleScrollListener = (shouldListen) => { + if (shouldListen) { + window.addEventListener('scroll', handleScroll, true); + } else { + window.removeEventListener('scroll', handleScroll, true); + isHidden.value = false; // Reset state when leaving + } +} + +watch(() => route.path, () => { + toggleScrollListener(!!route.meta.hideNavOnScroll); +}, { immediate: true }) // immediate: true runs this once on mount onUnmounted(() => { - window.removeEventListener('scroll', handleScroll, true); + toggleScrollListener(false); document.body.classList.remove('nav-hidden'); }) diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index b31d66f7c..933f664de 100755 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -7,7 +7,8 @@ const routes = [ }, { path: '/tutorial', - component: () => import('../pages/TutorialView.vue') + component: () => import('../pages/TutorialView.vue'), + meta: { hideNavOnScroll: true } }, { path: '/launch',