Phone: seamless top and bottom safe areas in Safari and the installed app (native feel) #293

Closed
opened 2026-10-14 14:25:30 +00:00 by kayg · 3 comments
Owner

kayg (2026-10-14 19:49 IST, iPhone, Safari and the installed app on calternal.cloud): "We should really fix the top and bottom safe areas of Safari to make it really seamless and feel like a native app."

Seen (screenshot on the thread, dark, photo backdrop, Style sheet open): below the sheet, the bottom safe area is a flat band of a different colour that doesn't match the backdrop or the sheet. The top status-bar area is a separate dark slab instead of the page continuing under it.

Wanted: native-app edges in both Safari (iOS 26 floating toolbar, Liquid Glass) and the installed home-screen app (standalone):

  • the backdrop (sky, photo or plain) and the page paint all the way under the status bar and the home indicator, with no bands or seams;
  • the content keeps clear of them with env(safe-area-inset-*);
  • sheets reach the bottom edge (their background runs under the home indicator, their content padded above it);
  • the status bar text stays readable in light and dark.

Research first (web search is fine), then post the findings with sources on this issue:

  • viewport-fit=cover, apple-mobile-web-app-status-bar-style (black-translucent), theme-color with media queries for light and dark (and whether iOS 26 Safari still uses it to tint the bars or samples the page), apple-mobile-web-app-capable / manifest display: standalone;
  • how iOS 26 Safari picks its toolbar and status-bar tint (sampling fixed elements near the edges), 100dvh/lvh/svh, and the rubber-band overscroll colour (html/body background);
  • known WebKit bugs with position: fixed and safe areas.

Constraints:

  • Keep the earlier phone-bar work (#226 rounds 1–2, the 240-case pixel spec).
  • The bottom bar's exact offset belongs to #290; coordinate rather than duplicate.
  • No layout shift, no machinery.

Evidence: WebKit emulation at 320/375/390/430 with safe-area insets, standalone and browser, light and dark, sky/photo/plain, with a sheet open and closed. Then a short checklist for kayg to try on the phone.

kayg (2026-10-14 19:49 IST, iPhone, Safari and the installed app on calternal.cloud): "We should really fix the top and bottom safe areas of Safari to make it really seamless and feel like a native app." **Seen (screenshot on the thread, dark, photo backdrop, Style sheet open):** below the sheet, the bottom safe area is a flat band of a different colour that doesn't match the backdrop or the sheet. The top status-bar area is a separate dark slab instead of the page continuing under it. **Wanted:** native-app edges in both **Safari** (iOS 26 floating toolbar, Liquid Glass) and the **installed home-screen app** (standalone): - the backdrop (sky, photo or plain) and the page paint all the way under the status bar and the home indicator, with no bands or seams; - the content keeps clear of them with `env(safe-area-inset-*)`; - sheets reach the bottom edge (their background runs under the home indicator, their content padded above it); - the status bar text stays readable in light and dark. **Research first (web search is fine), then post the findings with sources on this issue:** - `viewport-fit=cover`, `apple-mobile-web-app-status-bar-style` (black-translucent), `theme-color` with media queries for light and dark (and whether iOS 26 Safari still uses it to tint the bars or samples the page), `apple-mobile-web-app-capable` / manifest `display: standalone`; - how iOS 26 Safari picks its toolbar and status-bar tint (sampling fixed elements near the edges), `100dvh`/`lvh`/`svh`, and the rubber-band overscroll colour (html/body background); - known WebKit bugs with `position: fixed` and safe areas. **Constraints:** - Keep the earlier phone-bar work (#226 rounds 1–2, the 240-case pixel spec). - The bottom bar's exact offset belongs to #290; coordinate rather than duplicate. - No layout shift, no machinery. **Evidence:** WebKit emulation at 320/375/390/430 with safe-area insets, standalone and browser, light and dark, sky/photo/plain, with a sheet open and closed. Then a short checklist for kayg to try on the phone.
Author
Owner

Research: how iOS 26 Safari and the installed app paint the top and bottom edges

How Safari 26 picks the colour of its status bar and toolbar

  • theme-color is ignored by Safari 26's Liquid Glass bars. Chrome on Android still reads it, so we keep it in step with the page. A manifest theme_color loses to the meta tag. (Ben Frain, 1ar.io, Huxpro PR)
  • Safari samples position: fixed and sticky elements near the edges. Community findings put the limits at about 4px from the top or 3px from the bottom, at least 80% of the width, and at least 3px tall. Safari reads the element's own background-color (and possibly backdrop-filter). It ignores absolutely positioned children and pseudo-elements. A fixed element at opacity: 0 still counts; only display: none takes it out. (jahir.dev, 1ar.io)
  • Showing a fixed overlay retints the bars. A dialog, popover or dimming layer does this. It's WebKit 302272, a duplicate of 300965 (the fix landed in 26.2, but the reporter says it isn't fully fixed; follow-up 303167). A semi-transparent fixed overlay can also turn the toolbar see-through. (Ben Frain, jahir.dev)
  • When Safari finds no fixed element there, it uses the root's background-color. That's html (or body), never a gradient. A transparent root falls back to white in light and black in dark. (1ar.io, Huxpro PR)
  • Fixed content isn't drawn below the floating toolbar. It's clipped at the visible viewport, and the strip under the toolbar shows page content or the root colour. (Apple forums 800798, Apple forums 801694) This is why our backdrop already sits in the page on 26.4+ (scroll-link.ts, #105).
  • viewport-fit=cover is required for the page to run under the toolbar and status bar, and for env(safe-area-inset-*) to be non-zero. We already have it.

Viewport units

  • svh is the viewport with the toolbar shown, lvh with it hidden, and dvh follows it live. Our app is --vh: 100svh tall, so it never jumps. The backdrop layer is 100lvh, so it covers the toolbar strip in either state. In the installed app the three are the same.
  • Rubber-band overscroll shows the root's background colour. overscroll-behavior: none on html (we have it) mostly stops it.

The installed app (standalone)

  • apple-mobile-web-app-status-bar-style: black-translucent draws the page under the status bar. There's no Safari toolbar, so nothing is sampled, and what you see at the edges is simply the page. The style is cached when the app is added to the Home Screen; changing it needs a re-add (WebKit 260508).
  • Status-bar text colour: older docs say black-translucent always gives white text (Polymer PR). I found no source on iOS 26 behaviour, so it goes on the phone checklist (light theme especially).
  • The manifest's display: standalone, background_color and theme_color set the launch screen. They can't vary between light and dark, so a dark-theme launch flashes the light colour briefly. That's minor, and it's noted here, not changed.

What this means for the bug in the screenshot (dark, photo, Style sheet open)

On the phone, the sheet's dimming layer is position: fixed; inset: 0 (BottomBar .scrim):

  1. Top: Safari samples that fixed layer as the tint for its status bar. That's the "separate dark slab".
  2. Bottom: its parent screen is moved with translate, so the dim is only as tall as the small viewport. In Safari it's also fixed, so it isn't drawn under the toolbar anyway. The strip under the toolbar shows the page's undimmed edge colour: "a flat band of a different colour".

Plan:

  • Make the dim an ordinary in-page layer (position: absolute), so Safari never samples it.
  • While a phone sheet is open, set data-dim on the root. The root colour (what Safari fills the bars with, and theme-color) becomes the page edge colour with the same dim mixed in. The backdrop layer, which is what Safari draws under the toolbar, dims by the same amount over its full height, overscan included.
  • Then the status bar, the page, the strip under the toolbar and the home-indicator area are all one dimmed colour. In the installed app the in-page dim covers the status bar too.
  • The sheet stays a floating sheet above the home indicator (#257). Its bottom offset belongs to #290.
## Research: how iOS 26 Safari and the installed app paint the top and bottom edges **How Safari 26 picks the colour of its status bar and toolbar** - **`theme-color` is ignored** by Safari 26's Liquid Glass bars. Chrome on Android still reads it, so we keep it in step with the page. A manifest `theme_color` loses to the meta tag. ([Ben Frain](https://benfrain.com/ios26-safari-theme-color-tab-tinting-with-fixed-position-elements/), [1ar.io](https://1ar.io/updates/safari-26-liquid-glass-web/), [Huxpro PR](https://github.com/Huxpro/hux.pro/pull/92)) - **Safari samples `position: fixed` and `sticky` elements near the edges.** Community findings put the limits at about 4px from the top or 3px from the bottom, at least 80% of the width, and at least 3px tall. Safari reads the element's own `background-color` (and possibly `backdrop-filter`). It ignores absolutely positioned children and pseudo-elements. A fixed element at `opacity: 0` still counts; only `display: none` takes it out. ([jahir.dev](https://jahir.dev/blog/safari-toolbar), [1ar.io](https://1ar.io/updates/safari-26-liquid-glass-web/)) - **Showing a fixed overlay retints the bars.** A dialog, popover or dimming layer does this. It's WebKit [302272](https://bugs.webkit.org/show_bug.cgi?id=302272), a duplicate of [300965](https://bugs.webkit.org/show_bug.cgi?id=300965) (the fix landed in 26.2, but the reporter says it isn't fully fixed; follow-up [303167](https://bugs.webkit.org/show_bug.cgi?id=303167)). A semi-transparent fixed overlay can also turn the toolbar see-through. ([Ben Frain](https://benfrain.com/ios26-safari-theme-color-tab-tinting-with-fixed-position-elements/), [jahir.dev](https://jahir.dev/blog/safari-toolbar)) - **When Safari finds no fixed element there, it uses the root's `background-color`.** That's `html` (or `body`), never a gradient. A transparent root falls back to white in light and black in dark. ([1ar.io](https://1ar.io/updates/safari-26-liquid-glass-web/), [Huxpro PR](https://github.com/Huxpro/hux.pro/pull/92)) - **Fixed content isn't drawn below the floating toolbar.** It's clipped at the visible viewport, and the strip under the toolbar shows page content or the root colour. ([Apple forums 800798](https://developer.apple.com/forums/thread/800798), [Apple forums 801694](https://developer.apple.com/forums/thread/801694)) This is why our backdrop already sits in the page on 26.4+ (`scroll-link.ts`, #105). - **`viewport-fit=cover` is required** for the page to run under the toolbar and status bar, and for `env(safe-area-inset-*)` to be non-zero. We already have it. **Viewport units** - `svh` is the viewport with the toolbar shown, `lvh` with it hidden, and `dvh` follows it live. Our app is `--vh: 100svh` tall, so it never jumps. The backdrop layer is `100lvh`, so it covers the toolbar strip in either state. In the installed app the three are the same. - Rubber-band overscroll shows the root's background colour. `overscroll-behavior: none` on `html` (we have it) mostly stops it. **The installed app (standalone)** - `apple-mobile-web-app-status-bar-style: black-translucent` draws the page under the status bar. There's no Safari toolbar, so nothing is sampled, and what you see at the edges is simply the page. The style is cached when the app is added to the Home Screen; changing it needs a re-add ([WebKit 260508](https://bugs.webkit.org/show_bug.cgi?id=260508)). - **Status-bar text colour:** older docs say black-translucent always gives white text ([Polymer PR](https://github.com/Polymer/pwa-starter-kit/pull/321)). I found no source on iOS 26 behaviour, so it goes on the phone checklist (light theme especially). - The manifest's `display: standalone`, `background_color` and `theme_color` set the launch screen. They can't vary between light and dark, so a dark-theme launch flashes the light colour briefly. That's minor, and it's noted here, not changed. ### What this means for the bug in the screenshot (dark, photo, Style sheet open) On the phone, the sheet's dimming layer is `position: fixed; inset: 0` (BottomBar `.scrim`): 1. **Top:** Safari samples that fixed layer as the tint for its status bar. That's the "separate dark slab". 2. **Bottom:** its parent screen is moved with `translate`, so the dim is only as tall as the small viewport. In Safari it's also fixed, so it isn't drawn under the toolbar anyway. The strip under the toolbar shows the page's undimmed edge colour: "a flat band of a different colour". **Plan:** - Make the dim an ordinary in-page layer (`position: absolute`), so Safari never samples it. - While a phone sheet is open, set `data-dim` on the root. The root colour (what Safari fills the bars with, and `theme-color`) becomes the page edge colour with the same dim mixed in. The backdrop layer, which is what Safari draws under the toolbar, dims by the same amount over its full height, overscan included. - Then the status bar, the page, the strip under the toolbar and the home-indicator area are all one dimmed colour. In the installed app the in-page dim covers the status bar too. - The sheet stays a floating sheet above the home indicator (#257). Its bottom offset belongs to #290.
Author
Owner

Evidence (PR #304)

Playwright can't draw Safari's bars, so they're faked the way phone-bars.spec does it. Insets go through --safe-*. In browser mode the app is the small viewport (--vh) and the bottom 90px is the strip Safari's toolbar covers. Standalone is the installed app, with no toolbar. The spec reads real pixel rows from these screenshots.

Before → after, dark, photo, Style sheet open, browser mode. Before: the strip under the toolbar is the undimmed page colour (the band kayg saw), and the dim layer was a fixed element on the edge, which Safari takes its status bar tint from. After: one colour from the top edge to the bottom edge.

Chromium 390: chromium-390-browser-dark-photo-sheet.png chromium-390-browser-dark-photo-sheet.png

WebKit 430: webkit-430-browser-dark-photo-sheet.png webkit-430-browser-dark-photo-sheet.png

WebKit 320: browser light sky sheet · browser dark photo sheet · installed light sky sheet · installed dark photo sheet · browser dark plain palette · browser light photo closed

webkit-320-browser-light-sky-sheet.png webkit-320-browser-dark-photo-sheet.png webkit-320-standalone-light-sky-sheet.png webkit-320-standalone-dark-photo-sheet.png webkit-320-browser-dark-plain-palette.png webkit-320-browser-light-photo-closed.png

WebKit 390: browser light sky sheet · browser dark photo sheet · installed light sky sheet · installed dark photo sheet · browser dark plain palette · browser light photo closed

webkit-390-browser-light-sky-sheet.png webkit-390-browser-dark-photo-sheet.png webkit-390-standalone-light-sky-sheet.png webkit-390-standalone-dark-photo-sheet.png webkit-390-browser-dark-plain-palette.png webkit-390-browser-light-photo-closed.png

WebKit 375: browser dark photo sheet · installed light plain sheet · installed dark sky palette · browser light sky closed

webkit-375-browser-dark-photo-sheet.png webkit-375-standalone-light-plain-sheet.png webkit-375-standalone-dark-sky-palette.png webkit-375-browser-light-sky-closed.png

WebKit 430: browser dark photo sheet · installed light plain sheet · installed dark sky palette · browser light sky closed

webkit-430-browser-dark-photo-sheet.png webkit-430-standalone-light-plain-sheet.png webkit-430-standalone-dark-sky-palette.png webkit-430-browser-light-sky-closed.png

Edge check (e2e/phone-edges.spec.ts, new): the top and bottom rows match the root colour (ΔE < 2). theme-color equals the root colour. No band under the status bar or above the toolbar strip (ΔE < 2). No fixed layer with its own colour spans an edge.

widths modes schemes backdrops states Chromium WebKit
320, 375, 390, 430 browser, installed light, dark sky, photo, plain closed, sheet, palette 144/144 144/144

The same check on dev without the fix fails 24/36 at 390. phone-bars.spec (240 cases, #226) and safe-areas.spec still pass in both engines. At 320 (iPhone SE, no home indicator) the sheet and the palette reach the last rows, and their shadow lands there. That's no band, so the bottom-row check skips only that size when something is open.

Cost: opening and closing the dim adds one root style change each way, 4 ms median per toggle in Chromium on a 400-line note (8.1 ms for open plus close, p95 14.8 ms; WebKit software rendering 24 ms for the pair). It happens once per tap, alongside the sheet's own morph. Nothing changes while typing or scrolling.

(The crisp "hello" showing through the palette in WebKit is the headless software renderer's known glass artefact. It looks the same on dev.)

## Evidence (PR #304) Playwright can't draw Safari's bars, so they're faked the way phone-bars.spec does it. Insets go through `--safe-*`. In **browser** mode the app is the small viewport (`--vh`) and the bottom 90px is the strip Safari's toolbar covers. **Standalone** is the installed app, with no toolbar. The spec reads real pixel rows from these screenshots. **Before → after**, dark, photo, Style sheet open, browser mode. Before: the strip under the toolbar is the undimmed page colour (the band kayg saw), and the dim layer was a fixed element on the edge, which Safari takes its status bar tint from. After: one colour from the top edge to the bottom edge. Chromium 390: ![chromium-390-browser-dark-photo-sheet.png](https://git.kayg.org/attachments/5f7a90b1-c90f-4db7-86ba-b0bd553a3ad0) ![chromium-390-browser-dark-photo-sheet.png](https://git.kayg.org/attachments/2acc4144-4e98-4184-837d-8a0e2b6f7d7c) WebKit 430: ![webkit-430-browser-dark-photo-sheet.png](https://git.kayg.org/attachments/c5f4720f-e7c7-4b9e-a7e9-7f017a673f79) ![webkit-430-browser-dark-photo-sheet.png](https://git.kayg.org/attachments/fa75a1cc-fd4b-474f-bab6-95e2ee6bf202) **WebKit 320:** browser light sky sheet · browser dark photo sheet · installed light sky sheet · installed dark photo sheet · browser dark plain palette · browser light photo closed ![webkit-320-browser-light-sky-sheet.png](https://git.kayg.org/attachments/d4b78b85-08ab-426e-bb07-c0545de7a0f3) ![webkit-320-browser-dark-photo-sheet.png](https://git.kayg.org/attachments/911a18e0-bcf2-4ebd-b3bf-8eefeefede2a) ![webkit-320-standalone-light-sky-sheet.png](https://git.kayg.org/attachments/5c175c26-2fb3-4b8f-a871-ecafab621ba3) ![webkit-320-standalone-dark-photo-sheet.png](https://git.kayg.org/attachments/e9034c53-6c50-4ff9-887b-e490211fc168) ![webkit-320-browser-dark-plain-palette.png](https://git.kayg.org/attachments/e6fe2a33-884e-4956-93fc-b90448cdeed9) ![webkit-320-browser-light-photo-closed.png](https://git.kayg.org/attachments/84f7cd0d-a49d-41fc-b8ac-ef4a1a3057a1) **WebKit 390:** browser light sky sheet · browser dark photo sheet · installed light sky sheet · installed dark photo sheet · browser dark plain palette · browser light photo closed ![webkit-390-browser-light-sky-sheet.png](https://git.kayg.org/attachments/433fb823-8ae7-447c-b894-e9c1a4c0d9d6) ![webkit-390-browser-dark-photo-sheet.png](https://git.kayg.org/attachments/f493ae14-ac34-4afb-9cef-4f2bdb76dc3d) ![webkit-390-standalone-light-sky-sheet.png](https://git.kayg.org/attachments/7932bfcd-8ae0-4dfd-9e43-23f1287f3af4) ![webkit-390-standalone-dark-photo-sheet.png](https://git.kayg.org/attachments/ffae9fd6-a449-45cb-b689-45af2f5ba023) ![webkit-390-browser-dark-plain-palette.png](https://git.kayg.org/attachments/c703acc4-b1e5-4f8c-be39-24b2f0fa38ad) ![webkit-390-browser-light-photo-closed.png](https://git.kayg.org/attachments/574a7a83-a780-4e1e-bb8d-a23413a4dedd) **WebKit 375:** browser dark photo sheet · installed light plain sheet · installed dark sky palette · browser light sky closed ![webkit-375-browser-dark-photo-sheet.png](https://git.kayg.org/attachments/8765323c-42ec-475e-ab87-513e4469d9e8) ![webkit-375-standalone-light-plain-sheet.png](https://git.kayg.org/attachments/9283718d-44f4-453a-a3bf-62c5e73b2431) ![webkit-375-standalone-dark-sky-palette.png](https://git.kayg.org/attachments/f0561a6d-df37-4b5b-9f93-077afbffa68a) ![webkit-375-browser-light-sky-closed.png](https://git.kayg.org/attachments/515623ff-184f-4d64-9000-f20374394274) **WebKit 430:** browser dark photo sheet · installed light plain sheet · installed dark sky palette · browser light sky closed ![webkit-430-browser-dark-photo-sheet.png](https://git.kayg.org/attachments/9d2a197c-0d3f-45ce-82c5-a3441d6ab97a) ![webkit-430-standalone-light-plain-sheet.png](https://git.kayg.org/attachments/82d03eb3-c725-4bb2-a46c-4f7532a339d9) ![webkit-430-standalone-dark-sky-palette.png](https://git.kayg.org/attachments/e1ca04bb-235b-49fa-afc8-dfdb0f564130) ![webkit-430-browser-light-sky-closed.png](https://git.kayg.org/attachments/6cb05200-f9e7-44d7-969c-73a44062d2f7) **Edge check** (`e2e/phone-edges.spec.ts`, new): the top and bottom rows match the root colour (ΔE < 2). `theme-color` equals the root colour. No band under the status bar or above the toolbar strip (ΔE < 2). No fixed layer with its own colour spans an edge. | widths | modes | schemes | backdrops | states | Chromium | WebKit | |---|---|---|---|---|---|---| | 320, 375, 390, 430 | browser, installed | light, dark | sky, photo, plain | closed, sheet, palette | 144/144 | 144/144 | The same check on dev without the fix fails 24/36 at 390. phone-bars.spec (240 cases, #226) and safe-areas.spec still pass in both engines. At 320 (iPhone SE, no home indicator) the sheet and the palette reach the last rows, and their shadow lands there. That's no band, so the bottom-row check skips only that size when something is open. **Cost:** opening and closing the dim adds one root style change each way, 4 ms median per toggle in Chromium on a 400-line note (8.1 ms for open plus close, p95 14.8 ms; WebKit software rendering 24 ms for the pair). It happens once per tap, alongside the sheet's own morph. Nothing changes while typing or scrolling. (The crisp "hello" showing through the palette in WebKit is the headless software renderer's known glass artefact. It looks the same on dev.)
Author
Owner

Phone checklist for kayg (after #304 is deployed)

In Safari and in the installed app, light and dark, with the photo backdrop and then sky:

  1. Open a note and tap Style. The whole screen dims as one: the status bar, the page, and the bottom (under Safari's toolbar, or the home indicator in the app). There's no lighter band at the bottom and no separate dark slab at the top.
  2. Close the sheet (✕, a tap on the dim, or drag it down). The edges go back to the page colour at once, with no band left behind.
  3. Same with Insert and Note info.
  4. Safari only: scroll the note so the toolbar shrinks, then open Style. The strip under the small toolbar is dimmed too.
  5. Installed app, light theme: can you read the status-bar clock and battery over the light paper? If they're white on light, tell me. That's black-translucent, which iOS has always drawn as white text, and it's a separate fix.
  6. The list screens and the note with nothing open should look as they did after #226. If not, it's a regression.

If the app still shows the old look, close it fully from the app switcher and open it again. iOS keeps the old page for a while.

## Phone checklist for kayg (after #304 is deployed) In **Safari** and in the **installed app**, light and dark, with the photo backdrop and then sky: 1. Open a note and tap Style. The whole screen dims as one: the status bar, the page, and the bottom (under Safari's toolbar, or the home indicator in the app). There's no lighter band at the bottom and no separate dark slab at the top. 2. Close the sheet (✕, a tap on the dim, or drag it down). The edges go back to the page colour at once, with no band left behind. 3. Same with Insert and Note info. 4. Safari only: scroll the note so the toolbar shrinks, then open Style. The strip under the small toolbar is dimmed too. 5. Installed app, **light theme**: can you read the status-bar clock and battery over the light paper? If they're white on light, tell me. That's `black-translucent`, which iOS has always drawn as white text, and it's a separate fix. 6. The list screens and the note with nothing open should look as they did after #226. If not, it's a regression. If the app still shows the old look, close it fully from the app switcher and open it again. iOS keeps the old page for a while.
kayg closed this issue 2026-10-14 17:39:29 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#293
No description provided.