diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 426cbb39..20e18f68 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -978,14 +978,16 @@ Each account can set `booking_accent` in its profile. The default preserves the - **Teams on personal Microsoft accounts** — `teamsForBusiness` is work/school only, so a personal Microsoft account can't auto-mint Teams links; the organizer must supply a manual link (validated, and surfaced in the editor hint). -- **The admin SPA does not lay out below ~600px.** On the settings pages the nav and the - content sit in one flex row with no stacking breakpoint, so the content column is - squeezed to near-zero width and text wraps into a tall vertical sliver. Measured on - Settings → Profile at a 535px viewport: the `mx-auto max-w-4xl px-8` shell reported a - 151px client width and the form column 0. Affects every settings page, not one - component, so the fix is a breakpoint in the settings shell rather than per-page - patching. The **public** booking surfaces are unaffected and are verified on mobile; - this is admin-only. Deferred 2026-08-22, not a regression. +- **The admin SPA does not fully lay out below ~600px.** *Phase 1 landed (#226/#227): the + outer shell now stacks below `md` — the sidebar is an off-canvas drawer, a compact + header carries the menu button, and content scrolls instead of clipping.* Still future + work: the settings sub-nav (`frontend/src/routes/settings/+layout.svelte`, `flex gap-8` + with a `w-44 shrink-0` nav) does not stack, so settings pages still squeeze their form + column; and list/table views and multi-column forms need the phase 2/3 treatments. + Measured before phase 1 on Settings → Profile at 535px: the shell reported a 151px + client width and the form column 0. Affects every settings page, so that half is a + breakpoint in the settings shell rather than per-page patching. The **public** booking + surfaces are unaffected and are verified on mobile; this is admin-only. - **LiveKit room is not translated** - the booking surfaces, emails and calendar invites ship in 11 languages (§23), but the in-browser meeting UI is ~45 hardcoded English strings. It has its own vanilla-JS asset pipeline and shares no string plumbing with diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index 856a229d..93cbbaff 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -18,6 +18,16 @@ let reportOpen = $state(false); let recordingsConfigured = $state(false); let version = $state(''); + // Mobile nav drawer. Only ever opened from the md:hidden header button, so it is + // always false at desktop widths — which is what makes `inert` on
safe. + let sidebarOpen = $state(false); + // Focus handling: opening moves focus into the drawer, closing returns it to the + // trigger. Without this, opening leaves focus on the button the backdrop covers, + // and closing hides the focused element (`visibility: hidden`), dropping focus to + // and losing the user's place. + let sidebarEl: HTMLElement | null = $state(null); + let menuButtonEl: HTMLButtonElement | null = $state(null); + let drawerWasOpen = false; const ISSUES_URL = 'https://github.com/Calnode/calnode/issues'; const NEW_ISSUE_URL = 'https://github.com/Calnode/calnode/issues/new/choose'; @@ -130,7 +140,37 @@ ) ); + // Close the mobile drawer whenever the route changes, so tapping a nav link does not + // leave it open over the page it just navigated to. + $effect(() => { + void $page.url.pathname; + sidebarOpen = false; + }); + + // Move focus with the drawer. Effects run after the DOM flush, so the panel is + // already visible/current when the first link is focused. + $effect(() => { + if (sidebarOpen) { + drawerWasOpen = true; + sidebarEl?.querySelector('a[href], button')?.focus(); + } else if (drawerWasOpen) { + drawerWasOpen = false; + menuButtonEl?.focus(); + } + }); + onMount(async () => { + // Close the drawer if the viewport grows past md while it is open, so it cannot + // linger as an active overlay over the desktop layout. Specified in rem, not px: + // every `md:` class compiles to 48rem, which only equals 768px at the 16px + // default font size — in px the two thresholds drift apart and this listener + // would never fire for the band where the drawer is already unreachable. + const desktop = window.matchMedia('(min-width: 48rem)'); + const onDesktop = (e: MediaQueryListEvent) => { + if (e.matches) sidebarOpen = false; + }; + desktop.addEventListener('change', onDesktop); + if (isPublicRoute) { checking = false; return; @@ -180,6 +220,12 @@ } + { + if (e.key === 'Escape' && sidebarOpen) sidebarOpen = false; + }} +/> + {#if isPublicRoute} @@ -193,11 +239,45 @@ {#if $authStatus.demo_mode} {/if} -