Repository navigation
fix(pwa): collapse the top safe-area pad when the OS reserves the status bar (iPadOS 26.1+) - #777
Merged
Merged
Conversation
… 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.
This was referenced Sep 13, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-translucenthas no effect, while WebKit keeps reporting the oldenv(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 (iOSscreen.*never swaps; matched by aspect).SafeAreaProbe(root layout, renders nothing): in standalone mode, pin--safe-top: 0pxon<html>when the reserved height is at least a status bar; re-check on resize / orientationchange; hand back toenv()otherwise. iPhone and iPadOS ≤ 26.0 (still edge to edge) are unchanged. Topbar height, reader chrome padding and the reader scrim all collapse together.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.