Commit 1 of 1:
3832772e3f
fix(ui): keep the phone menu inside the visible viewport
whole branch
Review threads live on the whole diff, not on one commit, so
none are shown here - a thread's line means something in the
branch's final form, and painting it into an intermediate
step would put it on code it is not about.
resources/components/CommsHQ/MarketingNavigation.stx modified +5 -2 Changes to resources/components/CommsHQ/MarketingNavigation.stx ⋯ 72 lines Show the 72 lines above this hunk @@ -73,11 +73,11 @@ const featureGroups = [ 73 73 < div class = "flex gap-2 items-center sm:gap-3" > 74 74 < a href = "/login" class = "hidden lg:block font-semibold text-sm ink" > Sign in < / a > 75 75 < a href = "/register" class = "hidden sm:inline-flex items-center px-4 min-h-10 font-semibold text-sm text-[var(--coral-ink)] bg-coral rounded-md focus-visible:outline focus-visible:outline-[var(--coral)] focus-visible:outline-2 focus-visible:outline-offset-2" > Start free < / a > 76 - < details class = "md:hidden relative feature-menu" > 76 + < details class = "md:hidden relative feature-menu mobile-menu " > 77 77 < summary class = "inline-flex items-center justify-center h-11 w-11 list-none border border-tone rounded-md focus-visible:outline focus-visible:outline-[var(--coral)] focus-visible:outline-2 cursor-pointer feature-summary ink" aria - label = "Open navigation" > 78 78 < span class = "h-5 w-5 i-hugeicons-menu-01" aria - hidden = "true" > < / span > 79 79 < / summary > 80 - < div class = "absolute overflow-y-auto right-0 top-[calc(100%+0.65rem)] p-4 max-h-[calc( 100vh -6rem)] w-[min(92vw,380px)] border border-tone rounded-xl shadow-[0_24px_70px_rgba(32,29,26,0.18)] panel" > 80 + < div class = "absolute overflow-y-auto overscroll-contain right-0 top-[calc(100%+0.65rem)] p-4 max-h-[calc( 100dvh -6rem)] w-[min(92vw,380px)] border border-tone rounded-xl shadow-[0_24px_70px_rgba(32,29,26,0.18)] panel" > 81 81 < p class = "pb-2 px-3 font-bold text-[11px] tracking-[0.18em] uppercase coral" > Features < / p > 82 82 @ foreach ( featureGroups as group ) 83 83 < section class = "py-3 border-t border-tone first:border-0" > ⋯ 18 lines Show the 18 lines above this hunk @@ -102,4 +102,7 @@ const featureGroups = [ 102 102 < style > 103 103 . feature - summary : : - webkit - details - marker { display : none ; } 104 104 . feature - menu [ open ] > . feature - summary . feature - chevron { transform : rotate ( 180 deg ) ; } 105 + / * The phone menu scrolls inside the viewport , so the page behind it must 106 + not : otherwise the first flick past the panel 's end scrolls the page. */ 107 + @ media ( max - width : 767 px ) { body : has ( . mobile - menu [ open ] ) { overflow : hidden ; } } 105 108 < / style >
tests/Unit/MobileLayout.test.ts modified +11 -0 Changes to tests/Unit/MobileLayout.test.ts ⋯ 2 lines Show the 2 lines above this hunk @@ -3,6 +3,7 @@ import { readFileSync } from 'node:fs' 3 3 import { join } from 'node:path' 4 4 5 5 const auth = readFileSync ( join ( import . meta . dir , '../../resources/views/layouts/auth.stx' ) , 'utf8' ) 6 + const nav = readFileSync ( join ( import . meta . dir , '../../resources/components/CommsHQ/MarketingNavigation.stx' ) , 'utf8' ) 6 7 7 8 8 9 ⋯ 10 lines Show the 10 lines above this hunk @@ -19,4 +20,14 @@ describe('mobile layout contracts', () => { 19 20 expect ( viewport ) . toContain ( 'width=device-width' ) 20 21 expect ( viewport ) . not . toMatch ( / user - scalable = no | maximum - scale = 1 ( ? ! [ . \ d ] ) / ) 21 22 } ) 23 + 24 + 25 + 26 + it ( 'bounds the phone menu by the visible viewport and locks the page behind it' , ( ) => { 27 + const panel = nav . match ( / < details class = "[^" ] * mobile - menu [ ^ "]*" > [ \ s \ S ] * ? < div class = "([^" ] * ) "/)?.[1] ?? '' 28 + expect ( panel ) . toContain ( 'max-h-[calc(100dvh-6rem)]' ) 29 + expect ( panel ) . not . toContain ( '100vh' ) 30 + expect ( panel ) . toContain ( 'overscroll-contain' ) 31 + expect ( nav ) . toContain ( 'body:has(.mobile-menu[open]) { overflow: hidden; }' ) 32 + } ) 22 33 } )