Repository navigation
fix(dashboard): zero the top safe-area inset in in-browser contexts - #9838
Conversation
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Right layer (the plugin, so every top utility inherits the gate), top-edge-only scope, device-verified, and the fix is a clean CSS revert if wrong. Watch
[DESIGN-REVIEWED] 80780e3 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of No existing display-mode mechanism duplicated; the variable's consumers count 2; no bare top-inset readers remain outside the gate. The review is complete — final output follows. First-Principles-Verdict: PASS Manual verification covers only the broken WebView case — confirm an installed PWA (iOS notch, Android WebAPK) still gets its inset before merge. What this change shipsInventory (6 items) — 5 justifiedIntent: remove the inert ~34px band above the header when the dashboard runs in a WebView-based mobile browser over a display cutout, while keeping the installed-PWA notch inset — a FIX.
Provenance: reproduction written in the description with a measured value and device, plus a test that fails on base. Cause-level: the gate sits at the single plugin chokepoint; grep for [FIRST-PRINCIPLES-REVIEWED] 80780e3 |
UX Review (Fable 5) — ✅ PASSUX-level review of The diff is a layout-only fix — no controls added or changed; both states are screenshotted, the blind read ran, and the reader confirmed the "before" band read as wasted space or a mistake, which is exactly what the PR removes. The one alarming thing in the screenshots (the red overlapping status capsule) is pre-existing offline noise, untouched by this diff. UX-Verdict: PASS The fix deletes a dead band the blind reader itself called "wasted space or something that failed to appear" — comprehension confirmed, nothing new to learn. Watch
[UX-REVIEWED] 80780e3 |
With browser chrome on screen the UA's own bar already sits below the status bar / display cutout, so a non-zero env(safe-area-inset-top) there is spurious -- Android WebView browsers report the cutout height regardless of where the web view actually sits, which painted a dead ~34px band above the app header (p-safe on the shell). Only when the app IS the window (installed PWA: standalone/fullscreen display mode) does the viewport really extend under the cutout. Route the TOP edge of the safe-area tailwind utilities through --safe-area-top, which index.css zeroes by default and re-enables from env() only under (display-mode: standalone) or (display-mode: fullscreen). Bottom/left/right stay bare env() -- those insets are real even in-browser (iOS landscape notch flanks, home indicator). The one raw top-inset consumer (design-critique lightbox close) moves onto the same variable, and safeArea.guard.test.ts pins both halves of the gate at the source.
715ca98 to
80780e3
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Maintainer review (agent-assisted, on behalf of @bolichen97), head 80780e3f8.
Verified the top-inset gate end to end: tailwind.config.js:40-42 routes only the top edge through var(--safe-area-top, env(safe-area-inset-top)), index.css:298 declares --safe-area-top: 0px, and index.css:328-330 re-enables the env inset under display-mode: standalone/fullscreen, so the iOS PWA case keeps its notch inset while in-browser contexts drop the duplicate. Screenshots pinned to head; 6 files accounted for.
Non-blocking notes:
display-mode: browseralso matches a chromeless Android WebView drawn edge-to-edge, which now loses a real top inset — niche, opposite of the reported case, worth a sentence in the body.website/docs/narrow-viewport.md:100(the authoritative safe-area note) still describes the inset as bareenv(); add a line about the display-mode gate so nobody reintroduces it.safeArea.guard.test.ts:331pins an exact single-quoted string; a regex tolerant of quote style would match the neighbouring assertions.
…irodotdev#9838) With browser chrome on screen the UA's own bar already sits below the status bar / display cutout, so a non-zero env(safe-area-inset-top) there is spurious -- Android WebView browsers report the cutout height regardless of where the web view actually sits, which painted a dead ~34px band above the app header (p-safe on the shell). Only when the app IS the window (installed PWA: standalone/fullscreen display mode) does the viewport really extend under the cutout. Route the TOP edge of the safe-area tailwind utilities through --safe-area-top, which index.css zeroes by default and re-enables from env() only under (display-mode: standalone) or (display-mode: fullscreen). Bottom/left/right stay bare env() -- those insets are real even in-browser (iOS landscape notch flanks, home indicator). The one raw top-inset consumer (design-critique lightbox close) moves onto the same variable, and safeArea.guard.test.ts pins both halves of the gate at the source. Co-authored-by: Patrick Gao <patrigao@amazon.com>
Problem / Motivation
On Android browsers whose WebView reports a display-cutout inset, the dashboard renders a dead ~34px band between the browser's URL bar and the app's top bar. The band is inert — it is the shell's
p-safetop padding, not a control — so the mobile UX appears to have "a bar at the top that does nothing".Root cause:
env(safe-area-inset-top)is only meaningful when the viewport actually extends under the status bar / cutout. With browser chrome on screen, the UA's own bar already sits below the cutout — Safari reports 0 there, but Android WebView-based browsers report the cutout height regardless of where the web view sits. The shell (p-safe, from #5463) then double-insets: URL bar + spurious padding.Why it matters
Every user reaching the dashboard through a WebView-based mobile browser (corporate wrappers, in-app browsers) loses ~34px of a phone screen to an inert band and gets a broken-looking header. The iPhone-notch PWA case #5463 fixed must keep working at the same time.
What changed (motivation → approach → change)
env(safe-area-inset-top)trusted in contexts where the top inset cannot be real. The app only extends under the cutout when it IS the window — i.e. an installed PWA.display-modeis exactly that signal.var(--safe-area-top, env(safe-area-inset-top));index.csssets--safe-area-top: 0pxby default and re-enablesenv(safe-area-inset-top, 0px)only under(display-mode: standalone), (display-mode: fullscreen). All top utilities (p-safe,top-safe,top-safe-offset-*,top-safe-or-*) inherit the gate from the plugin. Bottom/left/right stay bareenv()— those insets are real even in-browser (iOS landscape notch flanks, home indicator with a minimized toolbar). The one raw top-inset consumer outside the utilities (design-critique lightbox close button) moves onto the same variable.Per display mode:
Tests
safeArea.guard.test.tsgains a source-pinning test for both halves of the gate (plugin routes top through the variable; index.css declares the 0px default and the display-mode re-enable). jsdom implements neitherenv()nordisplay-mode, so — like the compositor test that pins the drawer's left inset — the invariant is pinned at the source; reverting either half fails the test instead of silently reopening the band on physical hardware only.mobilePanels.compositor.test.tspass unchanged (33/33 across the two files).Manual verification
npm run buildverified: emitted CSS carries:root{--safe-area-top:0px}, the display-mode gate, and.p-safe{padding-top:var(--safe-area-top,env(safe-area-inset-top));…}.npx tsc --noEmitand eslint on touched files: clean.Screenshots / video
Rendered from the built dist at 390×700 (served statically without a backend, hence the offline noise in the status capsule — unrelated to this change). The "before" state is simulated by setting
--safe-area-top: 34px, the value measured on the reporting device; it is byte-for-byte the padding the old bare-env()form produced there, and also what a real standalone PWA under a cutout still gets after this change.Related Issues
no linked issue: found while using the dashboard from an Android WebView browser; no existing issue covers it.
Pattern harvest
Rule candidate: review-prompt
Pattern: "env(safe-area-inset-top) trusted outside standalone/fullscreen display modes — with browser chrome on screen the top inset cannot be real; route top-inset reads through the display-mode-gated variable."
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)