Repository navigation
fix(frontend): paint the iOS PWA status bar and keep it filled - #496
Conversation
| <QueryCachePersistenceProvider> | ||
| <ThemeProvider> | ||
| <TTSProvider> | ||
| <div aria-hidden="true" className="pointer-events-none fixed inset-x-0 top-0 z-40 h-[max(env(safe-area-inset-top),0.75rem)] md:h-[env(safe-area-inset-top)] bg-background" /> |
There was a problem hiding this comment.
Strip may cover content
The fixed strip is z-40 with a solid background, and below the md breakpoint it is never shorter than 0.75rem. Content is only kept clear when the page's top chrome uses pt-safe or --safe-area-top.
In a normal mobile browser tab, or a narrow desktop window, the inset is 0. There, any route, header or fixed or sticky element with a lower z-index and no pt-safe gets its top 12px hidden.
Fix options:
- Limit the floor, or the whole strip, to standalone display mode, e.g. a
[@media(display-mode:standalone)]variant. - Confirm that every top-level layout uses
--safe-area-top.
| --safe-area-top: calc(env(safe-area-inset-top) + min(env(safe-area-inset-top), 1rem)); | ||
| } | ||
|
|
||
| @media (width < 48rem) { | ||
| :root { | ||
| --safe-area-top: max(calc(env(safe-area-inset-top) + min(env(safe-area-inset-top), 1rem)), 0.75rem); | ||
| } |
There was a problem hiding this comment.
Missing env fallback
The old dialog style used env(safe-area-inset-top, 0px), but the new variable uses env() with no fallback.
--safe-area-top is only resolved where it is used. If env() is unsupported, or the variable is read where env cannot be resolved, padding-top falls back to its initial value. The phone 0.75rem floor is then lost along with it.
This only affects old or unusual engines. Adding the 0px fallback keeps the old safety at no cost.
| --safe-area-top: calc(env(safe-area-inset-top) + min(env(safe-area-inset-top), 1rem)); | |
| } | |
| @media (width < 48rem) { | |
| :root { | |
| --safe-area-top: max(calc(env(safe-area-inset-top) + min(env(safe-area-inset-top), 1rem)), 0.75rem); | |
| } | |
| --safe-area-top: calc(env(safe-area-inset-top, 0px) + min(env(safe-area-inset-top, 0px), 1rem)); | |
| } | |
| @media (width < 48rem) { | |
| :root { | |
| --safe-area-top: max(calc(env(safe-area-inset-top, 0px) + min(env(safe-area-inset-top, 0px), 1rem)), 0.75rem); | |
| } |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
User description
Problem
In an installed PWA on iOS 26/27 the status bar ignored
theme-colorandapple-mobile-web-app-status-bar-style, alternated between black and white, and iOS drew a progressive blur over the top of the page that made headers unreadable. iOS colours the bar by sampling a real fixed element at the top of the page and our top chrome was transparent, so it had nothing to sample.env(safe-area-inset-top)also reports 0 at launch, which collapses a fill sized to the inset.Change
RootLayout, painted with the app background, so the status bar samples the theme colour on every route including signed out.0.75remtall and give phone top padding (--safe-area-top) the same minimum, so the bar stays filled when iOS reports a 0 inset and the strip never covers header content.--safe-area-topso dialogs also start below the blur band.Tests
Dialog and page-header tests, typecheck and lint pass. Checked in the iPhone 18 Pro simulator (iOS 27.2) across home, assistant, session detail, schedules, files, the sessions sheet and settings, in dark and light themes.
PR Type
Bug fix
Description
Add a fixed full-width top strip painted with the app background so iOS samples the theme colour
Introduce a
--safe-area-topvariable with a0.75remfloor on phones for when the inset reports 0Route fullscreen dialog padding, close-button offset, and the
pt-safeutility through the shared variableUpdate the dialog test to assert the new variable-based padding
Diagram Walkthrough
File Walkthrough
App.tsx
Add fixed background strip for iOS status barfrontend/src/App.tsx
aria-hiddenfixed, full-width strip at the top ofRootLayout,painted with
bg-background0.75remtall on phones and fall back to the raw inseton desktop
z-40and disable pointer eventsdialog.tsx
Switch dialog safe-area padding to shared variablefrontend/src/components/ui/dialog.tsx
var(--safe-area-top)for fullscreen dialog top paddingfullscreen mode
dialog.test.tsx
Update dialog padding test expectationfrontend/src/components/ui/dialog.test.tsx
env()value tovar(--safe-area-top)index.css
Define minimum safe-area-top custom propertyfrontend/src/index.css
--safe-area-topas the inset plus a capped extra so the topstays filled
0.75remfor a zero reported insetpt-safeutility at the new variable