Research: Full Mobile-Responsive UI Audit & Polish
Feature: 034-mobile-responsive-auditDate: 2026-11-26 Spec: spec.md
Overview
This research consolidates architectural and UX decisions for executing the full 26-route mobile-responsive audit (T4.1.6) across src/frontend/ without adding runtime dependencies, altering backend APIs, or regressing desktop layouts.
1. Mobile Navigation Drawer & Sticky Header (FR-003)
- Decision: Add a reusable
SheetUI primitive built on the already-installed@radix-ui/react-dialog(^1.3.1) insrc/frontend/components/ui/sheet.tsx, replace the inline sticky dropdown insrc/frontend/components/Header.tsxwith a right-side slide-over drawer, and remove mobile hide-on-scroll logic so<header>stays consistentlysticky top-0 z-50. - Rationale:
@radix-ui/react-dialogalready ships inpackage.jsonand natively provides focus trapping, dimmed overlay backdrop, body scroll locking, Escape dismissal, outside-click dismissal, and ARIA dialog semantics (role="dialog",aria-modal="true").- The current
Header.tsximplementation uses asticky top-[73px]inline dropdown without backdrop, focus containment, or Escape handling, and itslastScrollYhide-on-scroll behavior causes visual jumps and misalignment when toggled mid-scroll. - Adding
motion-reduce:transition-none/motion-reduce:animate-nonerespects user reduced-motion preferences.
- Alternatives considered:
- Polishing the existing inline dropdown: Rejected during clarification (Option B selected); inline dropdowns cannot cleanly trap focus or prevent background scroll bleed on long pages.
- Installing a separate drawer library (
vaul): Rejected to avoid unnecessary third-party dependency additions when@radix-ui/react-dialogalready covers all drawer requirements cleanly.
2. Viewport-Bounded Dialogs with Pinned Header/Footer & Clamped Pickers (FR-004, FR-005)
- Decision: Upgrade
src/frontend/components/ui/dialog.tsxto enforce safe mobile viewport bounds (w-[calc(100vw-2rem)] sm:w-full,max-h-[calc(100dvh-2rem)],rounded-lg), increase the close button tap target to44×44 px(h-11 w-11effective hit area), add vertical gap (gap-2) to stacked mobileDialogFooterbuttons, and introduce aDialogBody(flex column layoutflex flex-col max-h-[calc(100dvh-2rem)] p-0with pinned header/footer andflex-1 overflow-y-autobody) for multi-field dialogs (ScanForm,AdminUsersCreate/Reset dialogs,AdminUserDetailReset dialog,AdminOperationstask detail dialog). Updatesrc/frontend/components/ui/date-picker.tsxto clamp popover width (w-[min(calc(100vw-3rem),316px)] max-w-full), support mobile-safe alignment inside dialogs, stack check-in/check-out date triggers (grid-cols-1 sm:grid-cols-2) inScanForm.tsx, and enlarge interactive controls inside the calendar. - Rationale:
- Current
DialogContentusesw-full max-w-lgwith zero horizontal margin on mobile, a16×16close icon, andsm:space-x-2onDialogFooter(leaving zero vertical gap when buttons stack viaflex-col-reverse). DatePickercurrently positions a fixedw-[290px]popover absolutely (left-0/right-0) inside scrolling containers, which risks horizontal clipping on 375 px screens—especially when paired side-by-side in a 2-column date grid inside a padded modal.- Pinning
DialogHeaderandDialogFooterwhile scrollingDialogBodyguarantees Close, Cancel, and Submit remain reachable on short 375×667 screens even when all filter sections are expanded.
- Current
- Alternatives considered:
- Full-screen mobile sheets for complex forms: Rejected during clarification (Option B selected); pinned-header/footer bounded dialogs preserve a unified dialog mental model across all screen sizes with less layout divergence.
- Replacing
DatePickerwith native<input type="date">on mobile: Rejected becauseDatePickerprovides stay-length previews, check-out anchoring, and quick duration presets tested acrossScanForm.dates.test.tsxanddate-picker.test.tsx.
3. Preventing iOS Safari Auto-Zoom & Touch Target Ergonomics (FR-002, FR-005)
- Decision: Update
src/frontend/components/ui/input.tsxand native<select>/<textarea>form controls to usetext-base sm:text-sm(16pxon mobile, preserving14pxonsm+desktop views), and audit primary mobile touch targets (header trigger, dialog close, pagination, filter chips, theme toggle, row action buttons, copy/test buttons) so they achieve at least44×44 pxeffective tap area (viamin-h-11 min-w-11or padded hit regions) on mobile viewports without inflating desktop density. - Rationale:
- Mobile Safari automatically zooms the viewport whenever a focused form field has computed
font-size < 16px, causing disorienting horizontal pan on Auth, Profile, ScanForm, and Admin forms. Usingtext-base sm:text-smeliminates auto-zoom completely on phones while keeping desktop pixel-identical. - Primary interactive controls using
h-10(40px) orh-7/h-8(28–32px) on touchscreens benefit from responsive mobile sizing (min-h-[44px] sm:min-h-0orh-11 sm:h-10on primary triggers) while compact secondary tags maintain ≥8 px spacing (gap-2).
- Mobile Safari automatically zooms the viewport whenever a focused form field has computed
- Alternatives considered:
- Disabling pinch-zoom via
<meta name="viewport" content="maximum-scale=1">: Rejected as an accessibility violation (WCAG 1.4.4).
- Disabling pinch-zoom via
4. Hybrid Mobile Strategy for Admin Tables (FR-009)
- Decision: Implement responsive stacked mobile card views (
md:hidden) alongside existing desktop tables (hidden md:block overflow-x-auto) for the three action-heavy management lists (AdminUsers.tsx,AdminInvites.tsx,AdminScans.tsx), while keeping and hardening self-contained horizontal scroll containers (overflow-x-auto,min-w-0on parent flex/grid wrappers, readable cell wrapping/truncation) for dense telemetry, log, and detail tables (AdminOperations.tsx,AdminAudit.tsx,AdminScanDetail.tsx,AdminTargetDetail.tsx,AdminUserDetail.tsx,AdminTrendsPanel.tsx). - Rationale:
- Selected during clarification (Option B). Action-heavy management rows contain emails, status badges, and multiple mutation buttons (approve/revoke, reset password, toggle admin/scanning, pause/delete scan) that are awkward to scroll horizontally to reach on a phone.
- Telemetry/log tables (task attempts, audit events, API percentile trend matrices) require side-by-side column scanning where horizontal scroll inside a contained wrapper is clearer and less noisy than tall repetitive cards.
- Keeping card and table markup colocated within each admin page (using small shared subcomponents only where repeated) honors Simplicity First and preserves existing desktop tables and tests unchanged.
- Alternatives considered:
- Scroll-only tables everywhere: Rejected during clarification; makes quick mobile admin actions (approving an invite, resetting a password) clunky.
- Stacked cards for every table including audit/task logs: Rejected during clarification; loses tabular comparability and adds unnecessary boilerplate.
5. Long-String Containment, Flex/Grid Overflow Traps & Recharts Mobile Sizing (FR-001, FR-008, FR-009)
- Decision: Systematically audit all 26 routes for the four classic Tailwind mobile overflow traps:
- Missing
min-w-0on flex/grid children containing long text or scrollable tables (especiallyAdminUserDetail,AdminScanDetail,AdminTargetDetail,Profile,NotificationSettings,ActiveSessions). - Multi-column
grid-cols-2metadata blocks with long emails/UUIDs/URLs (switch togrid-cols-1 sm:grid-cols-2withbreak-words/break-all). - Non-wrapping header/toolbar
flex items-center justify-betweenrows (addflex-wrap gap-2orflex-col sm:flex-row). - Chart legends/axes in
AdminTrendsPanel.tsxon 375 px screens (responsive height, angled/thinned ticks or concise tick formatting, wrapping time-window/metric controls).
- Missing
- Rationale:
- Even when inner tables have
overflow-x-auto, a CSS Grid or flex ancestor withoutmin-w-0expands to the table's intrinsic width and creates document-level horizontal overflow (scrollWidth > innerWidth).
- Even when inner tables have
6. Automated Mobile Visual & Overflow Verification (FR-014, SC-005)
- Decision:
- Add an automated document-level horizontal overflow assertion (
document.documentElement.scrollWidth <= window.innerWidth) to every mobile scenario executed insrc/frontend/tooling/run-snapshots.ts(and verify across 375 px, 390 px, and 768 px in an automated route-sweep check). - Add one representative mobile visual baseline (balancing
lightanddarkthemes across the newly covered routes) for every previously desktop-only route and critical overlay (~24–26 new mobile scenarios, bringing mobile coverage to 100% of application routes and key dialogs/pickers). - Capture and verify visual baselines using the locked Playwright Chromium build and matching fonts. The CI container and a local Chromium installation with those fonts are both supported.
- Add an automated document-level horizontal overflow assertion (
- Rationale:
- Currently 24 desktop scenarios lack mobile baselines (
auth,providers,how-it-works,faq,ethos,home-search-dropdown,map-selected,dashboard-empty,profile,scan-form-dialog,scan-form-checkin-calendar,scan-form-checkout-calendar,scan-delete-error, and 11 admin scenarios), pluscontact,contribute,privacy,terms, and the open mobile navigation drawer. - Adding one representative theme per newly added route keeps CI snapshot runtime fast (parallel Playwright workers in
run-snapshots.ts) while locking in visual and zero-overflow verification across all 26 routes.
- Currently 24 desktop scenarios lack mobile baselines (
- Alternatives considered:
- Adding both light and dark baselines for every single route (+50 PNGs): Rejected during clarification (Option A selected) to balance coverage with CI runtime and baseline maintenance overhead.