Skip to content

Safe-area support for the Drawer; nav-side inset contract - #108

Draft
microbit-matt-hillsdon wants to merge 1 commit into
mainfrom
safe-area-nav
Draft

Safe-area support for the Drawer; nav-side inset contract#108
microbit-matt-hillsdon wants to merge 1 commit into
mainfrom
safe-area-nav

Conversation

@microbit-matt-hillsdon

Copy link
Copy Markdown
Contributor

The Drawer now pads by the safe-area insets and paints the status-bar strip with the statusBarBg gradient, matching the full-size dialog. Side insets are placement-aware and mirrored under dir=rtl.

Drawer and full-size dialog side paddings read new runtime variables, --safe-area-nav-left/right, falling back to the raw env() insets. The variables distinguish the system navigation bar (content must stay clear) from a camera cutout (content may flow under) — a split env() cannot express. SharedUIProvider writes them from an app-supplied safeAreaNavSource: a native shell with real inset metadata, e.g. Android's WindowInsets API via a Capacitor plugin. Without a source they stay unset and the env() fallbacks apply — conservative, never occluded. See the README's CSS-variable contract.

ml-trainer's size heuristic (larger side inset = nav bar) was considered and dropped rather than moved here: its output only differs from the env() fallback on Android landscape with 3-button nav and a cutout, exactly the case the native source answers with real data.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 22, 2026

Copy link
Copy Markdown

Deploying ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: 969b777
Status: ✅  Deploy successful!
Preview URL: https://20348197.ui-2wg.pages.dev
Branch Preview URL: https://safe-area-nav.ui-2wg.pages.dev

View logs

The Drawer now pads by the safe-area insets and paints the status-bar
strip with the statusBarBg gradient, matching the full-size dialog. Side
insets are placement-aware and mirrored under dir=rtl.

Drawer and full-size dialog side paddings distinguish the system
navigation bar (content must stay clear) from a camera cutout (content
may flow under) — a split env() cannot express. New runtime variables
--safe-area-nav-left/right carry it: SharedUIProvider writes them from
an app-supplied safeAreaNavSource, a native shell with real inset
metadata such as Android's WindowInsets API via a Capacitor plugin.
Without a source they stay unset and consumers fall back to the raw
env() insets — conservative, never occluded.

New spacing tokens safeAreaTop/Bottom/NavLeft/NavRight define the
inset expressions (fallbacks included) once; the recipes and app code
consume the tokens. See the README's CSS-variable contract.

ml-trainer's size heuristic (larger side inset = nav bar) was
considered and dropped rather than moved here: its output only differs
from the env() fallback on Android landscape with 3-button nav and a
cutout, exactly the case the native source answers with real data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant