Overlay Register — LynCareOS Frontend
Version: 1.7
Last Updated: 2026-07-29 18:29:13
Purpose
Section titled “Purpose”This register inventories every overlay, dialog, sheet, and full-screen capture flow in the LynCareOS SPA. It exists so we can sign off on functional tier (centred dialog vs task flow vs documented exception) before consolidating ~20 bespoke fixed inset-0 implementations onto shared primitives.
Reference UX (target default): LogDoseQuickMedsModal → components/ui/Modal.tsx — centred on all viewports, fade + scale, rounded cc-card, no slide-up on mobile.
Scrim recipe (agreed target — one recipe only): bg-black/45 backdrop-blur-sm.
Rationale (mobile): backdrop-filter forces the compositor to snapshot and blur the whole viewport, and cost scales with radius and painted area. backdrop-blur-sm is 4px on Tailwind 3.4 — the cheapest radius that still reads as a blur, and a real token rather than an arbitrary value such as backdrop-blur-[2px] (which cannot be linted or tokenised cleanly). The 45% tint is the deciding factor: at bg-black/70 the scrim is opaque enough to hide the blur entirely, so the GPU cost is paid for no visible benefit — the worst trade on a low-end Android. At 45% the blur is perceptible, and if backdrop-filter is unsupported the layer degrades to a legible dim. Tailwind plus autoprefixer already emit -webkit-backdrop-filter, so iOS Safari needs no special handling.
Current state: Modal.tsx is still bg-black/70 backdrop-blur-sm; BottomSheet.tsx is bg-black/40 backdrop-blur-[2px]. Neither matches the target yet — see §Mobile readiness audit.
Tier taxonomy
Section titled “Tier taxonomy”| Tier | Name | When to use | Shared primitive |
|---|---|---|---|
| D1 | Centred dialog | Confirmations, short forms, pickers, read-only detail | Modal.tsx (enhanced) |
| D2 | Tall dialog | Long scroll body + optional sticky footer; still a “popup” not a page | Enhanced Modal.tsx (scroll body + footer slot) |
| T1 | Task / immersive | Camera, crop, multi-step wizard, body map capture | Dedicated sheet/overlay components |
| T2 | Full-screen page (mobile) | Flows that are effectively a route on small screens | Page shell with breakpoint split |
| X1 | Documented exception | Product decision to differ from D1; must cite reason | Keep bespoke or narrow primitive |
| — | Not a dialog | Decorative backdrop, dropdown dismiss layer | Out of migration scope |
Shared primitives (today)
Section titled “Shared primitives (today)”| Primitive | File | Mobile | Desktop | Notes |
|---|---|---|---|---|
| Modal | components/ui/Modal.tsx | Centred | Centred | Headless UI Dialog; preferred default |
| BottomSheet | components/ui/BottomSheet.tsx | Slide-up + swipe dismiss | Right panel (~28rem) | Portal, scroll lock; lighter blur |
| Bespoke hybrid | Various | items-end + animate-slide-up | Often centred | Copy-paste pattern; primary consolidation target |
Capability gaps (Modal must close before mass migration)
Section titled “Capability gaps (Modal must close before mass migration)”Corrected 2026-07-29 17:33 after reading @headlessui/react ^2.2.9 behaviour — two gaps were already closed:
- Portal to
document.body— Headless UIDialogportals by default - Body scroll lock — Headless UI
Dialogapplies it by default (also gives Escape-to-close and a focus trap) - Scrollable body region with max height (
dvh-capped) - Sticky footer slot (primary / secondary actions)
- Safe-area padding (
env(safe-area-inset-bottom)) -
overscroll-containon the scroll region - Stacking / nested dialog policy (z-index ladder) — closed 2026-07-29 17:35, see §Stacking ladder
Consequence: the 11 dialogs already on Modal inherit correct portal, scroll-lock, Escape and focus behaviour. Every bespoke overlay has to hand-roll all of it, and most do not — that is the substance of the audit below.
Stacking ladder
Section titled “Stacking ladder”The bug this closed
Section titled “The bug this closed”Modal.tsx was pinned at z-50 while sheets and page shells sit at z-[60]. Because relative z-50 opens a stacking context, every dialog opened from inside a sheet painted behind its own parent — fully occluded by the parent’s backdrop and its opaque panel. Nothing appeared on screen, yet Headless UI still moved focus into the invisible dialog, and Escape then closed both it and the parent. The trigger looked like a dead button wired to nothing.
Live at the time of the fix:
| Trigger | Dialog | Parent | Visible symptom |
|---|---|---|---|
| Log a dose → Edit quick picks | LogDoseQuickMedsModal | LogDosePageShell z-[60] | Desktop ≥1024px only: no response at all. Worked on mobile, where the shell renders as a plain page with no wrapper — which is why it shipped as “Delivered” |
| Log a dose / alert row → reaction detail | AdverseReactionDetailModal | LogDosePageShell, AlertInbox panel | Regressed by the MED-04 migration in v1.2 |
| Add items → delete saved card | DeleteCardConfirmDialog | AddItemsSheet → BottomSheet | Regressed by the SHOP-08 migration in v1.2 |
VitalEntryModal (PAIN-01, also migrated in v1.2) was unaffected — it opens from page content, with no overlay parent.
The ladder
Section titled “The ladder”Tiers are named in frontend/tailwind.config.js under theme.extend.zIndex, following the same “named scale enforced via config” pattern as the typography scale. Use the named class; do not introduce new arbitrary z-[N] for overlays.
| Rung | Class | Value | Used for |
|---|---|---|---|
| Chrome | z-chrome | 40 | Fixed app chrome — mobile top bar, nav |
| Popover | z-popover | 50 | Anchored dropdowns, selects, click-away layers |
| Sheet backdrop | z-sheet-backdrop | 55 | Dimmer behind a sheet or side panel |
| Sheet | z-sheet | 60 | BottomSheet panel, LogDosePageShell, AlertInbox desktop panel |
| Dialog | z-dialog | 100 | Modal.tsx — opened from page content or from a sheet |
| Task | z-task | 200 | Immersive capture opened from a dialog — ImagePickerSheet, CropImageSheet |
| Interrupt | z-interrupt | 1100 | App-level interrupt — UpgradeGate, WelcomeModal, idle warning |
| Notification | z-notification | 9999 | Transient hints and toasts |
Ordering rule: an overlay may only open into a higher tier — never a lower or equal one. A Modal that needs to launch a camera or crop step must use the task rung, not another dialog. ImagePickerSheet (was 80) and CropImageSheet (was 70) moved up to task for exactly this reason: today they are only opened from bespoke sheets, but SHOP-05 ShoppingListRow is slated to become a Modal, which would have occluded them. They share one rung safely because both call sites unmount the picker before opening the crop step.
Inline vs portaled (governing rule)
Section titled “Inline vs portaled (governing rule)”Portaled overlays (createPortal to document.body, or Headless UI Dialog) leave their parent’s stacking context and compete on the global ladder — they must use a named rung (z-sheet, z-dialog, etc.).
Inline overlays and inline panels (e.g. a clock face expanding inside an open dialog, a nested sheet rendered as a child of its parent overlay) are scoped by the parent’s stacking context. Their z-index is relative to siblings inside that parent only; they do not need an absolute rung number to beat unrelated overlays elsewhere in the app.
ClockPickerField (2026-07-29) was corrected to always render its panel inline inside its container. The previous mobile-only portal to document.body at zIndex: 60 painted behind Modal at z-dialog (100) on phones. Desktop already used the inline path — mobile now matches.
ESLint (no-restricted-syntax on src/pages/** and src/components/**) rejects new fixed inset-0 overlays that use arbitrary z-[N]. Files listed in §Raw z-index exceptions are grandfathered until migration.
Not yet on the ladder
Section titled “Not yet on the ladder”Bespoke overlays keep their own values until their migration row lands. Deliberate exceptions worth knowing:
FirstDoseReactionModalz-[70]sits betweensheetanddialogon purpose: it opens over the log-dose shell, and theModal-basedAdverseReactionDetailModalit can launch must land above it. Explicit ordering here is more robust than giving both thedialogrung and relying on DOM order as the tie-break. Revisit with MED-03.ConditionPackPreviewDialog,CancelSubscriptionDialogz-[1000]drop toz-dialogon migration — both open from plain pages, so nothing needs to stack above them.CareCaptureOverlayz-[1100]is a task (T1) parked on the interrupt value; it opens from a page, so re-tiering is cosmetic.Theclosed 2026-07-29 —VitalsCaptureSheet/MobileTopBarz-40tie (defect theme 5)VitalsCaptureSheetmoved toz-sheet(60), abovez-chrome(40) mobile top bar.
Raw z-index exceptions (grandfathered)
Section titled “Raw z-index exceptions (grandfathered)”These files still use arbitrary z-[N] on fixed inset-0 overlays. ESLint excludes them until each row migrates. Map nested chains explicitly — do not blanket-rename.
| File | Current | Target rung | Notes |
|---|---|---|---|
CancelSubscriptionDialog.tsx | z-[1000] | z-dialog | Opens from plain page |
UpgradeGate.tsx | z-[1100] | z-interrupt | App-level gate |
WelcomeModal.tsx | z-[1100] | z-interrupt | App-level gate |
CareCaptureOverlay.tsx | z-[1100] | z-task | Full-screen capture (T1) |
ConditionPackPreviewDialog.tsx | z-[1000] | z-dialog | Opens from plain page |
FamilyHelpBoardPopup.tsx | z-[55] | z-sheet-backdrop + z-sheet | Hybrid popup |
GroupDispenseModal.tsx | z-[60] | z-dialog | Nested under CellSheet z-50 — map chain |
FirstDoseReactionModal.tsx | z-[70] | keep between sheet/dialog | Deliberate — see above |
ScanFlow.tsx (nested step) | z-[60] | z-dialog | Nested inside parent z-50 step |
admin/Subscriptions.tsx | z-[1000] | z-dialog | Admin modal |
history/HistoryView.tsx | z-[1100] | z-interrupt | History-lock upgrade prompt |
Bare z-50 / z-60 (no brackets) — not yet ESLint-guarded; still tracked for migration: IntakeOutputInlineCapture, CellSheet, GroupModal, ScriptActionSheet, EditScriptModal, FillModal, NewListModal, AddCustomProductSheet, AutoDispense, ImageOverlay, ScanFlow (outer step).
Mobile readiness audit
Section titled “Mobile readiness audit”Method (2026-07-29 17:33): static census of frontend/src for scrim signatures (fixed inset-0 + dark tint), viewport units, createPortal, document.body.style.overflow, overscroll-contain, env(safe-area-inset-*), role="dialog" / aria-modal, Escape handlers, and z-index values. Not verified: behaviour on physical devices, touch-target sizes, and the inner content of the 7 overlays that sit on BottomSheet (they inherit the primitive’s behaviour, but their bodies were not individually inspected).
Defect themes, ranked by mobile impact
Section titled “Defect themes, ranked by mobile impact”1. vh instead of dvh — 8 overlays (highest impact). On iOS Safari 100vh is the largest viewport (URL bar retracted), so a max-h-[90vh] panel is taller than the visible area whenever the URL bar is showing, pushing the save/confirm row off-screen with no way to reach it. Offenders: ScanFlow (95vh), CellSheet (90vh), ConditionPackPreviewDialog (90vh), FamilyHelpBoardPopup (92vh), NewFamilyHelpRequestModal (70vh), LogDoseQuickMedsModal (50vh), CancerPrimarySitePicker (45/55vh), ImageOverlay (90vh). Already correct: IntakeOutputInlineCapture, LogDosePageShell, EditScriptModal, CareCaptureOverlay, BottomSheet, admin/Subscriptions.
2. No body scroll lock — ~19 bespoke overlays. The page scrolls behind the sheet under a touch drag, and on iOS the reading position is lost on dismiss. Only LogDosePageShell, CareCaptureOverlay, BottomSheet and the Headless UI Modal lock scroll. Note IntakeOutputInlineCapture (urine/bowel) portals and caps height correctly but does not lock scroll.
3. No portal — ~19 bespoke overlays. position: fixed resolves against the nearest transformed or filtered ancestor, so an inline fixed inset-0 can be offset or clipped inside Layout’s scroll container and the isolate / z-stacking contexts in PainBodyMapTab. The original VitalEntryModal header comment documented exactly this hazard; it is now handled for that file by Headless UI, but not for the bespoke set.
4. No overscroll-contain on scroll bodies — all but 4. Reaching the end of a modal list rubber-bands and scroll-chains to the page behind on iOS. Present only in IntakeOutputInlineCapture, CareCaptureOverlay, BottomSheet, CancerPrimarySitePicker.
5. Ad-hoc z-index ladder — no tokens. Partly fixed 2026-07-29 17:35 — tailwind.config.js now defines a named zIndex scale and the overlay tiers that matter are on it (see §Stacking ladder). This was not a latent risk: Modal at z-50 sat below the z-[60] sheets that open it, so three dialogs were invisible in production. Still open: VitalsCaptureSheet (z-40, not portaled) ties MobileTopBar (z-40), so paint order depends only on DOM order — fragile and needs device verification; and SleepSelectionHint (z-[9999]) plus the ScheduledDosesStrip tooltip (z-[6000]/z-[8000]) sit above every dialog including the interrupt tier.
6. Scrim fragmentation — 6 recipes plus 9 with no blur. bg-black/70 blur-sm (Modal, 11 dialogs), bg-slate-900/60 blur-sm (4 bespoke), bg-black/45 blur-sm (2), bg-black/40 blur-sm (2), bg-black/40 blur-[2px] (BottomSheet), bg-slate-900/40 blur-[2px] (2), bg-black/30 blur-[2px] (1); the whole scripts/medication family plus FamilyHelpBoardPopup use a plain tint with no blur.
7. Mobile layout split. The scripts/medication family and the shopping sheets use items-end + animate-slide-up on mobile; Modal, UpgradeGate, WelcomeModal and LogDosePageShell centre on all viewports. Doc reference UX says centred — each surviving slide-up needs an X1 justification or migration.
8. Keyboard and a11y. Escape-to-close is hand-rolled in only 4 bespoke files; 14 files declare role="dialog" / aria-modal. Bespoke sheets have no focus trap, so keyboard and screen-reader users can reach the page behind the scrim.
9. Touch targets — close buttons and secondary icon buttons systematically undersized. (Added 2026-07-29 17:50 — closes the “touch targets not audited” caveat from v1.3.) Standard per 03-DESIGN-SYSTEM.md is ≥44px, 48px for primary. Primary actions comply almost everywhere because .btn / .cc-btn / .input bake in min-h-[44px] / 48px. The failure is concentrated in dismiss and secondary controls, and every dialog has one:
| Component | Element | Rendered size |
|---|---|---|
ui/BottomSheet | Close | cc-icon-chip w-9 h-9 → 36×36 (inherited by all 7 consumers) |
AlertInbox | Close (desktop panel) | w-9 h-9 → 36×36 |
NewListModal | Close | w-9 h-9 → 36×36 |
AddItemsSheet | Clear search | w-9 h-9 → 36×36 |
ShoppingListRow | Compact qty −/+ | w-9 h-9 → 36×36 (desktop branch; mobile branch is w-12 h-12 ✓) |
LogDosePageShell | Close | p-2 + 18px icon → ~34×34 |
FamilyHelpBoardPopup | Close | p-2 + 18px icon → ~34×34 |
ConditionPackPreviewDialog | Close | p-2 + 18px icon → ~34×34 |
UpgradeGate | Close | p-1 + icon → ~32×32 |
IntakeOutputInlineCapture | Close | p-1.5 + 15px icon → ~27×27 |
IntakeOutputSection | Delete entry | p-1.5 + 13px icon → ~25×25 (smallest found) |
Root cause: the shared .cc-icon-chip primitive is w-10 h-10 — 40px, already 4px under standard — and callers routinely shrink it further to w-9 h-9. Fixing the primitive to 44px and removing the caller overrides clears five of the rows above in one change.
Compliant references: VitalsCaptureSheet close (w-11 h-11), ShoppingListRow mobile controls (w-12 h-12 / w-11 h-11), FamilyHelpDetailSheet actions (!min-h-[48px]), AddItemsSheet search input (!min-h-[48px]).
One case static reading cannot settle: ui/Modal’s close button is btn-ghost p-1.5 with a 16px icon. .btn-ghost extends .btn, which sets both min-h-[44px] and px-4, then p-1.5 overrides padding. Height is therefore ≥44px, but the final horizontal box is somewhere between ~28px and ~48px depending on which padding utility wins in the compiled sheet. This needs a rendered measurement, not a source read.
10. BottomSheet consumer bodies are the healthiest surfaces in the app. (Closes the second v1.3 caveat.) All 7 consumers were inspected — AddItemsSheet, ShoppingListRow, FamilyHelpDetailSheet, AlertInbox, CalendarView, Schedule, Layout (person picker). They inherit correct portal, scroll lock, Escape, overscroll-contain, dvh cap and safe-area padding from the primitive, and their primary actions are explicitly 48px. Only two content defects were found, both listed in theme 9: AddItemsSheet’s clear-search chip and ShoppingListRow’s compact stepper branch. The one defect all 7 share is the primitive’s own 36px close button.
Re-audit 2026-07-29 17:56 — themes re-verified against the working tree
Section titled “Re-audit 2026-07-29 17:56 — themes re-verified against the working tree”Every theme above was re-checked after the v1.4 z-index work. Themes 1, 2, 3, 4, 6, 7, 8, 9, 10 are unchanged and still accurate — same file lists, same counts. OverlayScrim.tsx and check-overlay-scrims.mjs do not exist yet, so Phase 0 (scrim unification) and the enforcement guard are still open. Modal remains bg-black/70 backdrop-blur-sm; BottomSheet remains bg-black/40 backdrop-blur-[2px].
Two findings sharpened:
Theme 5 revised — the ladder exists but adoption stalled at 6 files, and the raw values now conflict with it. On the ladder: Modal (z-dialog), BottomSheet, AlertInbox, LogDosePageShell (z-sheet), ImagePickerSheet, CropImageSheet (z-task). Roughly 20 overlays are still on raw values that no longer map to any rung — z-50 (ScanFlow, ScriptActionSheet, GroupModal, CellSheet, EditScriptModal, FillModal, AutoDispense, NewListModal, AddCustomProductSheet, ImageOverlay, IntakeOutputInlineCapture), z-[55] (FamilyHelpBoardPopup panel — sitting on the backdrop rung), z-[60] (GroupDispenseModal, ScanFlow’s nested step), z-[70] (FirstDoseReactionModal), z-[1000] (ConditionPackPreviewDialog, CancelSubscriptionDialog, admin/Subscriptions — no rung at 1000), z-[1100] (UpgradeGate, WelcomeModal, HistoryView bespoke, CareCaptureOverlay).
Latent recurrence of the exact bug v1.4 fixed. Modal now sits at z-dialog (100). Any overlay above 100 that opens a Modal will hide it the same way LogDoseQuickMedsModal was hidden. Seven overlays are above the dialog rung on raw values: ConditionPackPreviewDialog, CancelSubscriptionDialog, admin/Subscriptions (1000), UpgradeGate, WelcomeModal, CareCaptureOverlay and HistoryView’s bespoke overlay (1100). HistoryView is the sharpest case — its four dialogs (HIST-01…04) are on Modal at 100 while the same file renders a bespoke overlay at 1100. Also still open: VitalsCaptureSheet (z-40) and TenantSwitcher’s dismiss layer (z-40) both tie MobileTopBar on the chrome rung.
Theme 9 is broader than overlays — it is app-wide. The v1.5 pass scoped touch targets to dialogs; re-auditing every .cc-icon-chip call site shows the same deficit throughout the app on interactive chips (decorative <span> uses are out of scope): LogDoseDatePicker and FamilyHelpDatePicker month arrows (w-8 h-8 → 32px), CatalogItemManager edit/confirm/cancel/delete (four at 32px), ModuleAccessRow open-module (32px), admin/Patients remove-carer (36px), AlertBell in the app chrome and ShoppingCatalogAdmin refresh (40px). Good counter-example in the same family: LogDoseAmountField steppers use w-12 h-12 (48px). This strengthens the case for fixing .cc-icon-chip itself to 44px rather than patching call sites.
Verification status — what is proven and what is not
Section titled “Verification status — what is proven and what is not”Verified statically (high confidence): every claim in themes 1–10 is a direct source read of frontend/src, re-checked against the working tree at 17:50. Fixed-dimension sizes (w-9 h-9, w-11 h-11) are exact; padding-plus-icon sizes are computed and marked ~.
Not verified on a device — and cannot be from the workstation. The dev stack was only partly up (backend reachable on 8021/8020, Vite on 5173 down) and the e2e harness needs E2E_USER_EMAIL / E2E_USER_PASSWORD against a seeded dev account, so no authenticated overlay was rendered.
More importantly, Chromium emulation would give a false pass on the top finding. vh and dvh diverge only where browser chrome dynamically retracts — iOS Safari and Android Chrome. In desktop Chromium, including Playwright’s Pixel 7 profile and any setViewportSize, 100vh === 100dvh, so theme 1’s clipping is invisible under emulation. The same holds for iOS rubber-band scroll chaining and for the real GPU cost of backdrop-filter. Emulation is not a substitute here.
Machine-checkable without a device (recommended additions):
a11y.spec.tscurrently runs axe withwcag2a/wcag2aa/wcag21aaonly. Target Size (Minimum) is WCAG 2.2 SC 2.5.8, taggedwcag22aain axe-core — so theme 9 is invisible to the existing suite. Adding that tag is a one-line change that surfaces it automatically.- Rendered-geometry assertions in the
mobile-chromeproject would settle the ambiguousui/Modalclose-button width. - The
vh, scroll-lock, portal and scrim invariants are better enforced by the proposedcheck-overlay-scrims.mjstext scan than by any browser, since they are source properties.
Residual device-only items → add to 22-PRODUCTION-MANUAL-QA.md: iOS Safari vh clipping with the URL bar visible (confirm the save row is reachable in ScanFlow, CellSheet, ConditionPackPreviewDialog, FamilyHelpBoardPopup); iOS rubber-band chaining on modal lists; backdrop-filter cost on a low-end Android; and VitalsCaptureSheet vs MobileTopBar paint order.
Mobile defect matrix (defect rows only)
Section titled “Mobile defect matrix (defect rows only)”Legend: OK = correct · — = absent · n/a = not applicable to that shell
| ID | Component | Height unit | Portal | Scroll lock | Overscroll | Scrim |
|---|---|---|---|---|---|---|
| MED-01 | LogDoseQuickMedsModal | 50vh | OK (Modal) | OK | — | black/70 |
| MED-03 | FirstDoseReactionModal | n/a | — | — | — | black/60 no blur |
| MED-05 | EditScriptModal | OK (92dvh) | — | — | — | black/60 no blur |
| MED-06 | FillModal | n/a | — | — | — | black/60 no blur |
| MED-07 | ScanFlow | 95vh | — | — | — | black/60 no blur |
| MED-08 | ImageOverlay | 90vh | — | — | n/a | black/90 no blur |
| MED-09 | ScriptActionSheet | n/a | — | — | — | black/60 no blur |
| MED-10 | CellSheet | 90vh | — | — | — | black/60 no blur |
| MED-11 | GroupModal | n/a | — | — | — | black/60 no blur |
| MED-12 | GroupDispenseModal | n/a | — | — | — | black/60 no blur |
| MED-13 | AutoDispense → GroupConfirmModal | n/a | — | — | — | black/60 no blur |
| SHOP-02 | AddCustomProductSheet | n/a | — | — | — | black/40 blur-sm |
| SHOP-03 | NewListModal | n/a | — | — | — | black/40 blur-sm |
| PAIN-02 | VitalsCaptureSheet | n/a | — | — | — | opaque; z-40 clash |
| PAIN-03 | IntakeOutputInlineCapture | OK (90dvh) | OK | — | OK | black/45 blur-sm |
| FH-01 | NewFamilyHelpRequestModal | 70vh | OK (Modal) | OK | — | black/70 |
| FH-03 | FamilyHelpBoardPopup | 92vh | — | — | — | black/45 no blur |
| CP-01 | ConditionPackPreviewDialog | 90vh | — | — | — | slate-900/60 blur-sm |
| ALERT-01 | AlertInbox (desktop panel) | n/a | — | — | — | black/30 blur-[2px] |
| PLAT-03 | WelcomeModal | n/a | — | — | — | slate-900/60 blur-sm |
| PLAT-04 | UpgradeGate | n/a | — | — | — | slate-900/60 blur-sm |
| PLAT-05 | CancelSubscriptionDialog | n/a | — | — | — | slate-900/40 blur-[2px] |
| PLAT-06 | admin/Subscriptions | OK (100dvh) | — | — | — | slate-900/40 blur-[2px] |
| HIST-01 | HistoryView (bespoke z-1100) | n/a | — | — | — | slate-900/60 blur-sm |
Reference implementations to copy from: MED-02 LogDosePageShell (portal, scroll lock, dvh, Escape, 45% + blur-sm) and CARE-01 CareCaptureOverlay (adds overscroll-contain and full safe-area padding). PLAT-06 admin/Subscriptions is the only overlay handling all four safe-area insets.
Recommended remediation order
Section titled “Recommended remediation order”- Phase 0 — enhance
Modal.tsx: adopt thebg-black/45 backdrop-blur-smscrim, add advh-capped scroll body withoverscroll-contain, a sticky footer slot, and safe-area padding. Extract the scrim intoui/OverlayScrim.tsxsoModalandBottomSheetshare one implementation. This alone fixes themes 1, 4 and 6 for all 11 dialogs already on the primitive. - Phase 0b — z-index tokens: DONE 2026-07-29 17:35.
zIndexscale added totailwind.config.js;Modalmoved to thedialogrung, which fixed the three occluded dialogs. Remaining from this phase: theVitalsCaptureSheet/MobileTopBartie, and adopting named rungs in the bespoke overlays as they migrate. - Phase 1 —
vh→dvhsweep: mechanical, low-risk, highest mobile payoff; can ship ahead of any migration. - Phase 2 — migrate the 9-file scripts/medication family off the copy-pasted
bg-black/60shell; they share one pattern, so they convert as a batch and gain portal, scroll lock and blur together. - Phase 3 — remaining bespoke D1/D2 per the existing verdict column.
- Enforcement (with Phase 0): ESLint
no-restricted-syntaxbanning scrim signatures outsidecomponents/ui/**and approved T1 files, plusfrontend/scripts/check-overlay-scrims.mjsas a text-scan backstop wired intonpm run validate:architecturealongsidecheck-brand-touchpoints.mjs. ESLint cannot catch class strings assembled in a separate module (e.g.lib/vitalsTheme.ts), which is why the script backstop is needed.
Register
Section titled “Register”Legend — Current shell: Modal | BottomSheet | Bespoke-centred | Bespoke-slide-up | Bespoke-hybrid (slide mobile / centred desktop) | Task | Dual-layout
Verdict: Keep | Migrate → Modal | Migrate → enhanced Modal | Keep tier T | Review
Status: Baseline (audit complete, no code change yet)
Medications & scripts
Section titled “Medications & scripts”| ID | Component | User goal | Current shell | Functional needs | Tier | Verdict | Status | Notes |
|---|---|---|---|---|---|---|---|---|
| MED-01 | logDose/LogDoseQuickMedsModal.tsx | Edit quick-pick meds on log-dose | Modal | Short form, centred | D1 | Keep (reference) | Fixed 2026-07-29 | Gold standard for shell + content. Was unreachable on desktop — occluded by its own parent shell until Modal moved to z-dialog; see §Stacking ladder. Only entry point for quick-pick config (no Medications settings screen) |
| MED-02 | logDose/LogDosePageShell.tsx | Log a dose (full flow) | Dual-layout | Mobile: full page; desktop ≥1024px: centred modal | T2 / D1 | Keep tier T2 | z-sheet 2026-07-29 | Documented exception. z-[60] → z-sheet (same value); it opens MED-01 and MED-04, so it must stay below dialog |
| MED-03 | medication/FirstDoseReactionModal.tsx | Record first-dose reaction | Bespoke-hybrid | Form + validation | D1 | Migrate → Modal | Baseline | No slide-up need. Keeps z-[70] deliberately — see §Stacking ladder “Not yet on the ladder” |
| MED-04 | medication/AdverseReactionDetailModal.tsx | View reaction detail | Modal | Read-only detail | D1 | Migrate → Modal | Done 2026-07-29 | Swapped shell to Modal; kept coral icon chip + clinical contacts content, dropped duplicate inner heading (title now lives in Modal’s title bar). Was invisible from Log a dose and the alert panel until the z-dialog fix |
| MED-05 | scripts/EditScriptModal.tsx | Edit script fields | Bespoke-hybrid | Medium form, scroll likely | D2 | Migrate → enhanced Modal | Baseline | |
| MED-06 | scripts/FillModal.tsx | Record script fill / restock | Bespoke-hybrid | Form + dates | D2 | Migrate → enhanced Modal | Baseline | |
| MED-07 | scripts/ScanFlow.tsx | Scan prescription (multi-step) | Bespoke-hybrid | Wizard, camera step, nested schedule offer | T1 | Keep tier T | Baseline | Stack risk: wizard → schedule |
| MED-08 | scripts/ImageOverlay.tsx | View scan at full resolution | Bespoke-centred | Lightbox, tap-away dismiss | T1 | Keep tier T | Baseline | Same class as image lightbox |
| MED-09 | medication-schedule/ScriptActionSheet.tsx | Script row actions (archive, etc.) | Bespoke-slide-up | Action list | D1 | Migrate → Modal | Baseline | Could be action menu pattern |
| MED-10 | medication-schedule/CellSheet.tsx | Cell / slot detail in schedule grid | Bespoke-slide-up | Detail + actions | D1 | Migrate → Modal | Baseline | |
| MED-11 | medication-schedule/GroupModal.tsx | Create / edit medication group | Bespoke-hybrid | Tall form | D2 | Migrate → enhanced Modal | Baseline | |
| MED-12 | medication-schedule/GroupDispenseModal.tsx | Confirm group dispense from schedule | Bespoke-hybrid | Confirm + list | D2 | Migrate → enhanced Modal | Baseline | |
| MED-13 | pages/AutoDispense.tsx → GroupConfirmModal | Confirm “dispense all” for group | Bespoke-hybrid | Confirm + item list | D2 | Migrate → enhanced Modal | Baseline | Inline component in page file |
Shopping
Section titled “Shopping”| ID | Component | User goal | Current shell | Functional needs | Tier | Verdict | Status | Notes |
|---|---|---|---|---|---|---|---|---|
| SHOP-01 | shopping/AddItemsSheet.tsx | Add items from catalog | BottomSheet | Tall scroll, search, multi-select | D2 | Review → enhanced Modal | Baseline | Pilot candidate after Modal gaps closed |
| SHOP-02 | shopping/AddCustomProductSheet.tsx | Add custom product | Bespoke-slide-up | Form | D2 | Migrate → enhanced Modal | Baseline | Often stacked on SHOP-01 |
| SHOP-03 | shopping/NewListModal.tsx | Create shopping list | Bespoke-hybrid | Short form | D1 | Migrate → Modal | Baseline | |
| SHOP-04 | shopping/CatalogItemEditModal.tsx | Edit catalog item (admin) | Modal | Form | D1 | Keep | Baseline | Already on primitive |
| SHOP-05 | shopping/ShoppingListRow.tsx | Adjust qty / row actions | BottomSheet | Stepper + actions | D1 | Migrate → Modal | Baseline | |
| SHOP-06 | shopping/ShoppingItemCard.tsx (edit qty portal) | Adjust item quantity inline | — | — | — | Removed | Done 2026-07-29 | Component was dead code (only self-referenced by its own test) — ShoppingListRow is the live implementation. Deleted file + test block, no UX change (nothing rendered it) |
| SHOP-07 | shopping/ShoppingItemCard.tsx (photo lightbox) | View item photo | — | — | — | Removed | Done 2026-07-29 | Same dead-code removal as SHOP-06 |
| SHOP-08 | shopping/DeleteCardConfirmDialog.tsx | Confirm delete saved card | Modal | Confirm | D1 | Migrate → Modal | Done 2026-07-29 | Swapped shell to Modal; same props/behaviour, no call-site changes needed. Was invisible inside SHOP-01 until the z-dialog fix — see §Stacking ladder |
| SHOP-09 | ui/ImagePickerSheet.tsx | Pick image (camera / gallery) | Task | Native picker, full viewport | T1 | Keep tier T | z-task 2026-07-29 | Used in shopping + scripts. Moved z-[80] → z-task so it stays above dialogs when SHOP-05 migrates |
| SHOP-10 | shopping/CropImageSheet.tsx | Crop product photo | Task | Crop UI, gestures | T1 | Keep tier T | z-task 2026-07-29 | Stack: picker → crop. Moved z-[70] → z-task; safe on one rung because both call sites unmount the picker first |
Pain, vitals & intake/output
Section titled “Pain, vitals & intake/output”| ID | Component | User goal | Current shell | Functional needs | Tier | Verdict | Status | Notes |
|---|---|---|---|---|---|---|---|---|
| PAIN-01 | pain/VitalEntryModal.tsx | Log vital from body map bar | Modal | Time + value form | D1 | Migrate → Modal | Done 2026-07-29 | Swapped shell to Modal; removed now-redundant manual Escape handler and close button (Headless UI Dialog already provides both) |
| PAIN-02 | vitals/VitalsCaptureSheet.tsx | Capture vitals (mobile-first) | Task | Large controls, possibly camera | T1 | Keep tier T | Baseline | |
| PAIN-03 | vitals/IntakeOutputInlineCapture.tsx | I/O capture inline | Dual-layout | Mobile sheet / desktop modal | T2 / D1 | Keep dual | Baseline | Breakpoint split intentional |
Care, family help & condition packs
Section titled “Care, family help & condition packs”| ID | Component | User goal | Current shell | Functional needs | Tier | Verdict | Status | Notes |
|---|---|---|---|---|---|---|---|---|
| CARE-01 | care-capture/CareCaptureOverlay.tsx | Care note / capture wizard | Task | Multi-step, full attention | T1 | Keep tier T | Baseline | |
| FH-01 | familyHelp/NewFamilyHelpRequestModal.tsx | New help request | Modal | Form | D1 | Keep | Baseline | |
| FH-02 | familyHelp/FamilyHelpDetailSheet.tsx | View help request detail | BottomSheet | Read detail, actions | D2 | Migrate → enhanced Modal | Baseline | |
| FH-03 | familyHelp/FamilyHelpBoardPopup.tsx | Board popup / quick view | Bespoke-hybrid | Detail overlay | D1 | Migrate → Modal | Baseline | |
| CP-01 | condition-packs/ConditionPackPreviewDialog.tsx | Preview template pack | Bespoke-hybrid | Read-only preview | D2 | Migrate → enhanced Modal | Baseline |
Calendar, schedule & alerts
Section titled “Calendar, schedule & alerts”| ID | Component | User goal | Current shell | Functional needs | Tier | Verdict | Status | Notes |
|---|---|---|---|---|---|---|---|---|
| CAL-01 | pages/calendar/CalendarView.tsx | Add care shift | BottomSheet | Form | D2 | Migrate → enhanced Modal | Baseline | |
| CAL-02 | pages/Schedule.tsx | Shift detail | BottomSheet | Detail + actions | D2 | Migrate → enhanced Modal | Baseline | |
| ALERT-01 | alerts/AlertInbox.tsx | Alert detail (mobile) | BottomSheet | Detail; desktop uses panel | X1 | Review | Baseline | Desktop inline panel — mobile sheet may stay X1 |
| ALERT-02 | alerts/AlertInbox.tsx | Filter / dismiss backdrop | Bespoke (backdrop) | Click-away | — | Out of scope | Baseline | Not a dialog tier |
Settings, auth, billing & platform
Section titled “Settings, auth, billing & platform”| ID | Component | User goal | Current shell | Functional needs | Tier | Verdict | Status | Notes |
|---|---|---|---|---|---|---|---|---|
| SET-01 | settings/InviteShareModal.tsx | Invite / share access | Modal | Form + copy link | D1 | Keep | Baseline | |
| SET-02 | settings/ReasonModal.tsx | Collect reason (audit) | Modal | Short text | D1 | Keep | Baseline | |
| SET-03 | settings/DeleteUserModal.tsx | Confirm user removal | Modal | Destructive confirm | D1 | Keep | Baseline | |
| PLAT-01 | Layout.tsx | Select person (mobile) | BottomSheet | Picker list | D1 | Migrate → Modal | Baseline | |
| PLAT-02 | IdleWarningModal.tsx | Session idle warning | Modal | Timer + actions | D1 | Keep | Baseline | |
| PLAT-03 | WelcomeModal.tsx | First-run welcome | Bespoke-centred | Marketing / onboarding | D1 | Migrate → Modal | Baseline | High z-index [1100] |
| PLAT-04 | UpgradeGate.tsx | Tier upgrade prompt | Bespoke-centred | CTA + dismiss | D1 | Migrate → Modal | Baseline | z [1100] — align stacking policy |
| PLAT-05 | CancelSubscriptionDialog.tsx | Confirm cancel subscription | Bespoke-hybrid | Confirm + copy | D1 | Migrate → Modal | Baseline | |
| PLAT-06 | pages/admin/Subscriptions.tsx | Upgrade / plan confirm | Bespoke-hybrid | Confirm | D1 | Migrate → Modal | Baseline | Admin surface |
| AUTH-01 | auth/TenantSwitcher.tsx | Dropdown dismiss layer | Light backdrop | Click-outside | — | Out of scope | Baseline | Not a dialog |
| AUTH-02 | auth/AuthWelcomeBackdrop.tsx | Login illustration | Fixed decorative | Non-interactive | — | Out of scope | Baseline | Not a dialog |
History & audit
Section titled “History & audit”| ID | Component | User goal | Current shell | Functional needs | Tier | Verdict | Status | Notes |
|---|---|---|---|---|---|---|---|---|
| HIST-01 | pages/history/HistoryView.tsx | Audit entry detail | Modal | Read-only JSON/detail | D2 | Keep | Baseline | size lg |
| HIST-02 | pages/history/HistoryView.tsx | Dose details | Modal | Read-only | D1 | Keep | Baseline | |
| HIST-03 | pages/history/HistoryView.tsx | Delete record confirm | Modal | Destructive confirm | D1 | Keep | Baseline | |
| HIST-04 | pages/history/HistoryView.tsx | Edit dispensing | Modal | Edit form | D2 | Keep | Baseline |
Summary counts
Section titled “Summary counts”| Category | Count |
|---|---|
| Total register entries | 50 (48 active, 2 removed as dead code) |
Already on Modal.tsx | 15 |
On BottomSheet.tsx | 7 |
| Bespoke (hybrid / slide-up / centred) | 16 |
| Task / immersive (T1) | 7 |
| Dual-layout (T2) | 2 |
| Out of scope (not dialogs) | 3 |
| Removed (dead code) | 2 |
| Verdict | Count |
|---|---|
| Keep as-is (reference or already Modal) | 11 |
| Keep tier T / dual | 9 |
| Migrate → Modal — done | 4 |
| Migrate → Modal — remaining | 11 |
| Migrate → enhanced Modal | 10 |
| Review (needs product sign-off) | 2 |
| Out of scope (not a dialog) | 3 |
| Removed (dead code) | 2 |
(Counts corrected 2026-07-29 16:57 — verified against actual row count; updated 2026-07-29 17:17 after first quick-win batch. See revision history.)
Stacking hotspots
Section titled “Stacking hotspots”Nested overlays must be tested during migration:
Migration policy (draft — pending sign-off)
Section titled “Migration policy (draft — pending sign-off)”- Default: all new overlays use
Modal.tsxunless register tier is T1, T2, or approved X1. - Phase 0: enhance
Modal.tsx(portal, scroll body, footer, safe-area, z-index). - Phase 1 pilot: Shopping —
AddItemsSheet→ enhanced Modal; validate scroll + sticky footer. - Phase 2: Batch migrate bespoke D1 hybrids (confirm dialogs, short forms).
- Phase 3: Batch migrate D2 (tall forms); retire or narrow
BottomSheetto approved X1 only. - CI guard (proposed): fail PRs that add
fixed inset-0underpages/orcomponents/outsideui/and approved T1 files.
Sign-off checklist
Section titled “Sign-off checklist”Use this when reviewing each row:
- User goal still accurate?
- Tier (D1 / D2 / T1 / T2 / X1) agreed?
- Any mobile slide-up that is required for ergonomics (thumb zone) — if yes, mark X1 with reason
- Stacking with parent flow documented?
- QA smoke path noted in 22-PRODUCTION-MANUAL-QA.md after migration
Related documents
Section titled “Related documents”- 03-DESIGN-SYSTEM.md — Calm Care tokens and primitives
- 14-FRONTEND-PRESENTATION-STACK.md — Motion and mobile capture
- 22-PRODUCTION-MANUAL-QA.md — manual QA flows
Revision history
Section titled “Revision history”| Version | Date | Change |
|---|---|---|
| 1.6 | 2026-07-29 17:56 | Re-audit against the working tree after the v1.4 z-index work. Themes 1–4 and 6–10 re-verified unchanged (same files, same counts); confirmed OverlayScrim.tsx and check-overlay-scrims.mjs do not exist, so Phase 0 and enforcement are still open. Revised theme 5: the ladder is real but adoption stalled at 6 files, with ~20 overlays on raw values that map to no rung — and flagged a latent recurrence of the v1.4 bug, since 7 overlays sit above the dialog rung (100) and would hide any Modal they open (HistoryView is the sharpest case: four Modal dialogs at 100 alongside its own bespoke overlay at 1100). Widened theme 9: the touch-target deficit is app-wide, not overlay-only — interactive .cc-icon-chip call sites in both date pickers, CatalogItemManager, ModuleAccessRow, admin/Patients, AlertBell and ShoppingCatalogAdmin are 32–40px. No code changed in this revision |
| 1.5 | 2026-07-29 17:50 | Closed both v1.3 audit caveats. Added theme 9 (touch targets — 11 undersized dismiss/secondary controls; root cause is .cc-icon-chip at 40px with callers shrinking to 36px) and theme 10 (all 7 BottomSheet consumer bodies inspected — healthiest surfaces in the app, only 2 content defects). Added Verification status section: recorded that device verification is not possible from the workstation and, critically, that Chromium emulation gives a false pass on theme 1 because 100vh === 100dvh without retracting browser chrome. Noted that a11y.spec.ts cannot see theme 9 because Target Size is WCAG 2.2 (wcag22aa) and the suite only requests through wcag21aa. Listed residual device-only checks for doc 22. No code changed in this revision |
| 1.4 | 2026-07-29 17:35 | Closed Phase 0b (z-index ladder) and fixed a live bug. Modal was pinned at z-50 beneath the z-[60] sheets that open it, so three dialogs rendered behind their own parent and looked like dead buttons: LogDoseQuickMedsModal (desktop Edit quick picks — reported by product owner), AdverseReactionDetailModal and DeleteCardConfirmDialog (both regressed by the v1.2 migrations). Added a named zIndex scale to tailwind.config.js (chrome/popover/sheet-backdrop/sheet/dialog/task/interrupt/notification); moved Modal to z-dialog; adopted named rungs in LogDosePageShell, BottomSheet, AlertInbox (values unchanged) and lifted ImagePickerSheet + CropImageSheet to z-task so future Modal migrations cannot occlude the camera/crop steps. Also corrected the stale “Medications → Manual dose shortcuts” entry point in the developer guide — that screen does not exist |
| 1.3 | 2026-07-29 17:33 | Added Mobile readiness audit — static census of all overlays for viewport units, portal, scroll lock, overscroll containment, safe-area, z-index and scrim recipe. Agreed one scrim recipe (bg-black/45 backdrop-blur-sm) with mobile rationale; corrected two Modal capability gaps already closed by Headless UI; recorded 8 vh-instead-of-dvh defects and the z-index tie between VitalsCaptureSheet and MobileTopBar. No code changed in this revision |
| 1.2 | 2026-07-29 17:17 | First quick-win batch shipped: deleted dead-code ShoppingItemCard.tsx (SHOP-06, SHOP-07); migrated DeleteCardConfirmDialog (SHOP-08), AdverseReactionDetailModal (MED-04), VitalEntryModal (PAIN-01) onto Modal.tsx as-is — no primitive enhancement needed. Verified: npm run build, lint:strict (no new errors), Shopping + PainTracking Vitest suites (73 tests) pass |
| 1.1 | 2026-07-29 16:57 | Corrected summary counts — actual row count is 50, not 44; verdict tally recomputed and reconciled against every row |
| 1.0 | 2026-07-29 | Initial register from frontend audit |