Skip to content

fix(pwa): collapse the top safe-area pad when the OS reserves the status bar (iPadOS 26.1+) - #777

Merged
mbryantms merged 1 commit into
mainfrom
fix/ipados-26-status-bar
Sep 13, 2026
Merged

mbryantms merged 1 commit into
mainfrom
fix/ipados-26-status-bar

Conversation

@mbryantms

Copy link
Copy Markdown
Owner

Since iOS / iPadOS 26.1, home-screen web apps no longer render under the status bar: the OS reserves an opaque bar of its own and black-translucent has no effect, while WebKit keeps reporting the old env(safe-area-inset-top). Every top bar pads by that inset via --safe-top, so the app padded twice — a blank band under the system bar on every page, and in the reader a dark scrim across the chrome.

  • web/lib/safe-area.ts: infer the OS-reserved height by comparing viewport height with screen height for the current orientation (iOS screen.* never swaps; matched by aspect).
  • SafeAreaProbe (root layout, renders nothing): in standalone mode, pin --safe-top: 0px on <html> when the reserved height is at least a status bar; re-check on resize / orientationchange; hand back to env() otherwise. iPhone and iPadOS ≤ 26.0 (still edge to edge) are unchanged. Topbar height, reader chrome padding and the reader scrim all collapse together.
  • Status-bar meta black-translucent → black: translucency buys nothing on current iPadOS and the opaque declaration makes the layout the same on every OS version.

Tests: 10 unit tests on the measurement, 3 jsdom tests on the probe (pin on mount, release on resize, cleanup on unmount).

Testing on device: iOS snapshots the status-bar meta at Add-to-Home-Screen time — remove and re-add the icon after this deploys.

… the status bar (iPadOS 26.1+)

Since iOS / iPadOS 26.1 home-screen web apps no longer render under the
status bar: the OS reserves an opaque bar of its own and the
`black-translucent` style has no effect, while WebKit keeps reporting the
old `env(safe-area-inset-top)`. Every top bar pads by that inset via
`--safe-top`, so the app padded twice — a blank band under the system
bar on every page, and in the reader a dark scrim (sized `--safe-top`)
showing through the 85%-opaque chrome.

`lib/safe-area.ts` infers how much the OS has taken off the top by
comparing the viewport height with the screen height for the current
orientation (iOS `screen.*` never swaps, so both sides are matched by
aspect). `SafeAreaProbe` (root layout, renders nothing) pins
`--safe-top: 0px` on <html> in standalone mode whenever that reserved
height is at least a status bar, re-checks on resize/orientationchange,
and hands back to `env()` otherwise — so iPhone and iPadOS ≤ 26.0, which
still run edge to edge, are unchanged. Every consumer (topbar height,
reader chrome padding, status-bar scrim) collapses together.

Also switch the status-bar meta to `black` (opaque): translucency buys
nothing on current iPadOS, and the opaque declaration makes the layout
the same on every OS version instead of depending on which one the icon
was installed from. iOS snapshots this meta at Add-to-Home-Screen time —
remove and re-add the icon after deploying.
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