|
51 | 51 | v-if="isMobileMenuOpen" |
52 | 52 | class="fixed inset-0 z-50 lg:hidden" |
53 | 53 | @click="toggleMobileMenu" |
| 54 | + @touchmove.prevent |
54 | 55 | > |
55 | 56 | <div class="absolute inset-0 bg-gray-600 opacity-75"></div> |
56 | 57 |
|
57 | | - <nav class="relative max-w-xs w-full bg-white dark:bg-gray-900 h-full shadow-xl"> |
58 | | - <div class="flex items-center justify-between px-4 py-4 border-b border-gray-200 dark:border-gray-700"> |
| 58 | + <nav |
| 59 | + class="relative max-w-xs w-full bg-white dark:bg-gray-900 h-full shadow-xl flex flex-col" |
| 60 | + @click.stop |
| 61 | + @touchmove.stop |
| 62 | + > |
| 63 | + <div class="flex items-center justify-between px-4 py-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0"> |
59 | 64 | <h2 class="text-lg font-semibold text-gray-900 dark:text-white">Navigation</h2> |
60 | 65 | <button |
61 | 66 | @click.stop="toggleMobileMenu" |
|
67 | 72 | </button> |
68 | 73 | </div> |
69 | 74 |
|
70 | | - <div class="px-4 py-6 overflow-y-auto"> |
| 75 | + <div class="flex-1 overflow-y-auto px-4 py-6" style="-webkit-overflow-scrolling: touch;"> |
71 | 76 | <div class="space-y-6"> |
72 | 77 | <div |
73 | 78 | v-for="section in navigationSections" |
@@ -122,6 +127,23 @@ const { navigationSections } = useNavigation() |
122 | 127 | const isMobileMenuOpen = inject('isMobileMenuOpen', ref(false)) |
123 | 128 | const toggleMobileMenu = inject('toggleMobileMenu', () => {}) |
124 | 129 |
|
| 130 | +// Handle body scroll locking for mobile menu |
| 131 | +watch(isMobileMenuOpen, (isOpen) => { |
| 132 | + if (process.client) { |
| 133 | + if (isOpen) { |
| 134 | + // Lock body scroll when mobile menu is open |
| 135 | + document.body.style.overflow = 'hidden' |
| 136 | + document.body.style.position = 'fixed' |
| 137 | + document.body.style.width = '100%' |
| 138 | + } else { |
| 139 | + // Restore body scroll when mobile menu is closed |
| 140 | + document.body.style.overflow = '' |
| 141 | + document.body.style.position = '' |
| 142 | + document.body.style.width = '' |
| 143 | + } |
| 144 | + } |
| 145 | +}) |
| 146 | +
|
125 | 147 | // Collapsible sections state |
126 | 148 | const collapsedSections = ref<Set<string>>(new Set()) |
127 | 149 |
|
|
0 commit comments