Skip to content

Commit 7a90e78

Browse files
DavidLambauerclaude
andcommitted
Fix mobile menu scrolling out of the viewport
The open docs menu was absolutely positioned without a height limit, and the page kept scrolling behind it, so scrolling to reach the lower items moved the menu and its close button out of view. Lock page scroll and trap focus while the menu is open (as the other header partial already does), let the menu scroll inside the space below the header, and close it when the window grows past the lg breakpoint so the page never stays locked on desktop. Fixes #51 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent dd3c956 commit 7a90e78

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎resources/views/docs.blade.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class="w-8 h-8 shrink-0 transition-all duration-300 lg:w-64 lg:h-12"
2525

2626
<header
2727
class="lg:hidden"
28+
x-trap.inert.noscroll="navIsOpen"
29+
@resize.window="navIsOpen = navIsOpen && window.innerWidth < 1024"
2830
@keydown.window.escape="navIsOpen = false"
2931
@click.away="navIsOpen = false"
3032
>
@@ -141,7 +143,7 @@ class="absolute inset-0 mt-2 ml-2 w-6 h-6"
141143
<nav
142144
x-show="navIsOpen"
143145
x-cloak
144-
class="absolute w-full transform origin-top shadow-sm z-10"
146+
class="absolute w-full max-h-[calc(100dvh-7.5rem)] overflow-y-auto overscroll-contain transform origin-top shadow-sm z-10"
145147
x-transition:enter="duration-150 ease-out"
146148
x-transition:enter-start="opacity-0 -translate-y-8 scale-75"
147149
x-transition:enter-end="opacity-100 scale-100"

0 commit comments

Comments
 (0)