Commit bb0a5808b3
Unsigned
Layout: unified · split
docs/.vitepress/theme/Layout.vue +18 −12
| @@ -22,8 +22,7 @@ import { sidebar } from '../configs/constants' | ||
| 22 | 22 | import AnnouncementPill from './components/AnnouncementPill.vue' |
| 23 | 23 | import NotFoundComponent from './components/NotFound.vue' |
| 24 | 24 | import { |
| 25 | NolebaseEnhancedReadabilitiesMenu, | |
| 26 | NolebaseEnhancedReadabilitiesScreenMenu | |
| 25 | NolebaseEnhancedReadabilitiesMenu | |
| 27 | 26 | } from './components/settings' |
| 28 | 27 | import SidebarCard from './components/SidebarCard.vue' |
| 29 | 28 | import { TakodachiStorageKey } from './constants' |
| @@ -173,7 +172,20 @@ const reloadTakodachi = () => { | ||
| 173 | 172 | onMounted(() => { |
| 174 | 173 | if (import.meta.env.SSR) return |
| 175 | 174 | |
| 176 | // Arrow key scrolling + Escape close for desktop sidebar | |
| 175 | // Arrow key scrolling + Escape close for sidebars and content | |
| 176 | let activeScrollTarget: HTMLElement | Window = window | |
| 177 | ||
| 178 | useEventListener(document, 'pointerdown', (e: PointerEvent) => { | |
| 179 | const el = e.target as HTMLElement | |
| 180 | if (homeSidebarOpen.value && sidebarRef.value?.contains(el)) { | |
| 181 | activeScrollTarget = sidebarRef.value | |
| 182 | } else if (el.closest('.VPSidebar')) { | |
| 183 | activeScrollTarget = el.closest('.VPSidebar') as HTMLElement | |
| 184 | } else { | |
| 185 | activeScrollTarget = window | |
| 186 | } | |
| 187 | }) | |
| 188 | ||
| 177 | 189 | useEventListener(document, 'keydown', (e: KeyboardEvent) => { |
| 178 | 190 | if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp' && e.key !== 'Escape') return |
| 179 | 191 | |
| @@ -182,13 +194,8 @@ onMounted(() => { | ||
| 182 | 194 | return |
| 183 | 195 | } |
| 184 | 196 | |
| 185 | const target = homeSidebarOpen.value | |
| 186 | ? sidebarRef.value | |
| 187 | : !isHome.value ? document.querySelector<HTMLElement>('.VPSidebar') : null | |
| 188 | if (!target) return | |
| 189 | ||
| 190 | 197 | e.preventDefault() |
| 191 | target.scrollBy({ top: e.key === 'ArrowDown' ? 60 : -60, behavior: 'smooth' }) | |
| 198 | activeScrollTarget.scrollBy({ top: e.key === 'ArrowDown' ? 60 : -60, behavior: 'smooth' }) | |
| 192 | 199 | }) |
| 193 | 200 | |
| 194 | 201 | // Close home NavScreen on outside click |
| @@ -317,9 +324,8 @@ onUnmounted(() => { | ||
| 317 | 324 | <VPSidebarGroup :items="homeSidebarGroups" /> |
| 318 | 325 | </nav> |
| 319 | 326 | </template> |
| 320 | <template #nav-screen-content-after> | |
| 321 | <NolebaseEnhancedReadabilitiesScreenMenu v-if="!isHome" /> | |
| 322 | </template> | |
| 327 | <template #nav-screen-content-after /> | |
| 328 | ||
| 323 | 329 | <template #nav-bar-title-before> |
| 324 | 330 | <span |
| 325 | 331 | v-if="isHome" |
docs/.vitepress/theme/styles/style.scss +1 −1
| @@ -1277,7 +1277,7 @@ table tr:nth-child(odd) { | ||
| 1277 | 1277 | bottom: 0; |
| 1278 | 1278 | left: 0; |
| 1279 | 1279 | z-index: calc(var(--vp-z-index-backdrop, 100) + 1); |
| 1280 | padding: 0 32px 96px; | |
| 1280 | padding: 0 32px 32px; | |
| 1281 | 1281 | width: var(--vp-sidebar-width); |
| 1282 | 1282 | max-width: calc(100vw - 64px); |
| 1283 | 1283 | background-color: var(--vp-sidebar-bg-color); |