Skip to content

fix(frontend): paint the iOS PWA status bar and keep it filled - #496

Merged
chriswritescode-dev merged 1 commit into
mainfrom
fix/ios-pwa-status-bar
Nov 28, 2026
Merged

chriswritescode-dev merged 1 commit into
mainfrom
fix/ios-pwa-status-bar

Conversation

@chriswritescode-dev

@chriswritescode-dev chriswritescode-dev commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

User description

Problem

In an installed PWA on iOS 26/27 the status bar ignored theme-color and apple-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

  • Add one fixed, full-width strip at the top of RootLayout, painted with the app background, so the status bar samples the theme colour on every route including signed out.
  • Keep the phone strip at least 0.75rem tall 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.
  • Route fullscreen dialog top padding through --safe-area-top so 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-top variable with a 0.75rem floor on phones for when the inset reports 0

  • Route fullscreen dialog padding, close-button offset, and the pt-safe utility through the shared variable

  • Update the dialog test to assert the new variable-based padding


Diagram Walkthrough

flowchart LR
  CSS["index.css: --safe-area-top"] -- "paints" --> Strip["App.tsx fixed top strip"]
  CSS -- "pads" --> Dialog["Dialog fullscreen content & close button"]
  CSS -- "feeds" --> PTSafe["pt-safe utility"]
  CSS -- "asserted in" --> Test["dialog.test.tsx"]
Loading

File Walkthrough

Relevant files
Bug fix
App.tsx
Add fixed background strip for iOS status bar                       

frontend/src/App.tsx
  • Add an aria-hidden fixed, full-width strip at the top of RootLayout,
    painted with bg-background
  • Keep it at least 0.75rem tall on phones and fall back to the raw inset
    on desktop
  • Place it above content with z-40 and disable pointer events
+1/-0     
dialog.tsx
Switch dialog safe-area padding to shared variable             

frontend/src/components/ui/dialog.tsx
  • Use var(--safe-area-top) for fullscreen dialog top padding
  • Use the same variable for the close button top offset in mobile
    fullscreen mode
+2/-2     
Tests
dialog.test.tsx
Update dialog padding test expectation                                     

frontend/src/components/ui/dialog.test.tsx
  • Update the fullscreen padding assertion from the raw env() value to
    var(--safe-area-top)
+1/-1     
Enhancement
index.css
Define minimum safe-area-top custom property                         

frontend/src/index.css
  • Define --safe-area-top as the inset plus a capped extra so the top
    stays filled
  • Add a phone breakpoint floor of 0.75rem for a zero reported inset
  • Point the pt-safe utility at the new variable
+8/-2     

Comment thread frontend/src/App.tsx
<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" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread frontend/src/index.css
Comment on lines +99 to +105
--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);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
--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);
}

@lil-worker-cstech

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
⚠️ Risk level: Medium
✅ Merge recommendation: Needs review
Merge recommendation checks
✅ CI on reviewed head: passed
✅ Head is current with its base: up to date
✅ Human authors: all authors are human
✅ No sensitive paths or risky changes: none detected
✅ Changed lines within cap: 17 changed lines (cap 100)
⚠️ Model merge recommendation: needs_review
⚠️ Model risk level: medium
🔎 Failure modes

What: On narrow viewports, the opaque `z-40` strip is always at least `0.75rem` tall. It can hide the top of any page, header or fixed element that is not padded with `pt-safe` or `var(--safe-area-top)`.
Where: frontend/src/App.tsx:RootLayout
Trigger: A screen narrower than 48rem where the reported inset is 0, such as a mobile Safari or Chrome tab, Android, or a narrow desktop window. The page's top content relies on its own spacing, or on raw `env(safe-area-inset-top)`, instead of `--safe-area-top`.
Detected by: Nothing automated. Only manual or visual checks on routes that are not padded with `pt-safe`.
Covered in this PR: No

What: Every `pt-safe` user and every mobile fullscreen dialog now gets up to `1rem` of extra top padding (inset + min(inset, 1rem)), even at md+ sizes. This can shift layouts that were sized to the plain inset, for example in an iPad PWA.
Where: frontend/src/index.css:--safe-area-top / pt-safe
Trigger: A device that reports a non-zero safe-area-inset-top at any width, such as an iPad or a notched phone in standalone mode.
Detected by: Nothing automated. The dialog test only checks that the variable string is present.
Covered in this PR: No

🧪 PR contains tests
🔒 No security concerns identified

@chriswritescode-dev
chriswritescode-dev merged commit c17e367 into main Nov 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant