Skip to content

Commit 35cf647

Browse files
authored
fix(theme): adjust z-index for VPNavBar and simplify VPNavScreen styles (#5374)
1 parent a0401ee commit 35cf647

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/client/theme-default/components/VPNavBar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const { isHome, hasSidebar } = useLayout()
7070
<style scoped>
7171
.VPNavBar {
7272
position: relative;
73+
z-index: 1;
7374
height: var(--vp-nav-height);
7475
pointer-events: none;
7576
white-space: nowrap;

src/client/theme-default/components/VPNavScreen.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { useScrollLock, useWindowScroll } from '@vueuse/core'
2+
import { useScrollLock } from '@vueuse/core'
33
import { inBrowser } from 'vitepress'
44
import VPNavScreenAppearance from './VPNavScreenAppearance.vue'
55
import VPNavScreenMenu from './VPNavScreenMenu.vue'
@@ -11,7 +11,6 @@ defineProps<{
1111
}>()
1212
1313
const isLocked = useScrollLock(inBrowser ? document.body : null)
14-
const { y } = useWindowScroll()
1514
</script>
1615

1716
<template>
@@ -20,7 +19,7 @@ const { y } = useWindowScroll()
2019
@enter="isLocked = true"
2120
@after-leave="isLocked = false"
2221
>
23-
<div v-if="open" class="VPNavScreen" id="VPNavScreen" :style="{ '--vp-y': y + 'px' }">
22+
<div v-if="open" class="VPNavScreen" id="VPNavScreen">
2423
<div class="container">
2524
<slot name="nav-screen-content-before" />
2625
<VPNavScreenMenu class="menu" />
@@ -36,15 +35,13 @@ const { y } = useWindowScroll()
3635
<style scoped>
3736
.VPNavScreen {
3837
position: fixed;
39-
/* reserve 1px for the VPNavBar divider */
40-
top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 1px - var(--vp-y));
38+
top: 0;
4139
/*rtl:ignore*/
4240
right: 0;
4341
bottom: 0;
4442
/*rtl:ignore*/
4543
left: 0;
46-
padding: 0 2rem;
47-
padding-top: var(--vp-y);
44+
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 1px) 2rem 0;
4845
width: 100%;
4946
background-color: var(--vp-nav-screen-bg-color);
5047
overflow-y: auto;

0 commit comments

Comments
 (0)