also looking at this
fix(ui): keep the phone menu inside the visible viewport
#9
2 files
+16
-2
| @@ -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 | // iOS Safari zooms the page when a focused input's font-size is under 16px, |
| 8 | 9 | // and leaves it zoomed and scrolled sideways afterwards. The sign-in and |
| @@ -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 | // 100vh is the largest the viewport ever gets on iOS, so a panel capped by it | |
| 25 | // runs under the browser's bottom bar; 100dvh tracks the visible height. | |
| 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 | }) |