Repository navigation
fix(pwa): static Apple/theme-color head tags (no churn on navigation) + latch probe - #1016
Merged
Merged
Conversation
…gation never rewrites them Observed with a MutationObserver on <head>: on EVERY client-side navigation Next re-renders its metadata tree, removing and re-inserting theme-color, color-scheme, apple-mobile-web-app-capable, -title and -status-bar-style (plus viewport/description/robots), even when nothing changed. An installed iPadOS app latches such a runtime change into a permanently blurred status-bar strip (force-quit resets it). #1014 only stopped the reader's own value change, so it could not help: the root tags still churned on each route change. The standalone test apps (#1009, #1011) never navigate, which is why they were always clean. - The apple-mobile-web-app-* / mobile-web-app-capable / color-scheme / theme-color tags are now static <head> children of RootLayout, which persists across navigations. Verified locally: across two in-app navigations they are the same DOM nodes with zero mutations; only Next's own viewport/description/robots tags still churn (no API to stop that), with identical values. - `generateViewport` becomes the static `baseViewport`; `themeHeadMeta` (lib/viewport.ts) replaces themedViewport/readerViewport. - tests/pwa/viewport.test.ts pins: tags present in the root layout, no route declaring them via the metadata/viewport API. - /pwa-lab variant P, a latch probe: sticky grey header (strip state at a glance), a document-wide logger that survives in-app navigation (every <meta> change in <head> with old/new values, every change of the element iOS samples at the top edge, per route), one button per candidate trigger — including "churn: remove + re-add all app metas", i.e. exactly the old Next behaviour — a real Reload, and clean/faded note buttons. Delete with the rest of the lab. iOS snapshots the apple-* tags at Add-to-Home-Screen time; the values are unchanged, so no reinstall is needed.
This was referenced Oct 4, 2026
Merged
mbryantms
added a commit
that referenced
this pull request
Oct 5, 2026
…nts (#1021) Device logs (iPadOS 27.0.1, v0.39.2): the strip flips from clean to faded after four plain navigations with no reader involved, and with the status-bar tags provably untouched (#1016). Every hop still shows two things: Next removing + re-inserting its viewport/description/robots metas (identical values; no API to stop it), and a moment right after each route change where the sample point lands on bare content before the new header mounts (`div.bg-background.grid.min-h-screen`), plus the headerless lab index page. New triggers, each run from a fresh force-quit on the probe page whose sticky header never leaves the screen: - "soft-navigate to this page": a real Next client navigation to the same page (new query string) — head churn + route transition, header present throughout; - "churn: remove + re-add the viewport meta" (same commit) and the slow variant (re-add after 300ms) — the viewport churn alone. The existing "hide the sticky header" button covers the no-top-bar case.
mbryantms
added a commit
that referenced
this pull request
Oct 5, 2026
…tches into content blur (#1022) Measured on iPadOS 27.0.1 with the /pwa-lab probe, each run from a fresh document (Reload): - a real Next navigation with the sticky header on screen throughout: strip stays clean; - removing + re-adding the viewport meta: clean; - hiding the sticky header for 2 s: FADED, and it stays faded for the life of the document (a reload clears it; the iPhone recovers on its own, the iPad does not). So the rule is: the first time iOS samples the top edge and finds no fixed/sticky bar, it switches the status-bar strip from the bar's colour to a blur of the page content and never switches back. The real app has such moments on every route change — the [locale] loading skeleton (`bg-background grid min-h-screen`) has no header, which the device logs caught right after each navigation — which is why every in-app navigation flipped it while the standalone test apps (never navigating) never did, and why #1014/#1016 (head-tag changes) could not help. Fix: a 12px fixed, full-width, app-background bar as the first child of <body> in the root layout. It is under every real header (z-0 vs their z-20/z-30) so it is invisible in normal use, and it is what the sample point hits whenever a header is absent. Verified locally: headerless page → backstop; page with sticky header, at rest and scrolled → header; header hidden → backstop. WebKit ignores edge bars ≤ 10px, hence 12. Probe: two new triggers hide the header with a 12px / 32px fixed bar behind it, to confirm on-device that 12px is enough.
mbryantms
added a commit
that referenced
this pull request
Oct 5, 2026
…a different bar (#1026) Root cause, measured on iPadOS 27.0.1 with a parameterised probe served from the dev box (no releases): the status-bar strip is painted in the colour of the fixed/sticky element iOS finds at the top edge, and the FIRST time that element changes — a header unmounting on a layout switch, the reader chrome taking over, any other bar swapped in — it switches to blurring the page content into the strip and never recovers for the life of the document. Shrinking the same header to 12px kept the strip clean; replacing it with any other bar (fixed or sticky, 12–56px, scrolling or not) latched it. This is why sidebar navigation (header persists) was clean while About → admin and the reader (header swapped) faded, why #1022's backstop could not help (it only became the sampled element after the header had gone, itself a change), and why head-tag work (#1014, #1016) was beside the point. - Root layout: `#top-edge`, the first child of <body>: sticky, z-9999, 12px (WebKit ignores bars ≤ 10px), negative margin so it costs no layout, in the page colour (`--top-edge-color`, default background). It is always what iOS samples: present from first paint, above every header and overlay. Replaces the fixed backstop. - The reader marks its root `data-surface="reader"`; globals.css turns the bar black there (same element, colour change only — verified clean on-device). - Verified on the iPad in one document: header hidden with a fixed 56px bar inserted, bar colour → black → back, header hidden with a sticky 20px bar, three route changes through a headerless page, scrolling — all clean. Browser check: #top-edge is the sampled element at rest, scrolled, with headers hidden, during the colour change and under a dialog overlay. - /pwa-lab: variant Q, a parameterised experiment console (position, height, colour, z-index, header kept/hidden, scroll lock, duration) plus a colour-change trigger; the sticky-vs-fixed ladder on P; the logger shared between them. manifest.ts: dev-only PWA_LAB_START_URL so a LAN dev server's installed app opens on a lab page instead of the API-backed home. Delete the lab once confirmed.
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.
Observed with a MutationObserver on : on EVERY client-side
navigation Next re-renders its metadata tree, removing and re-inserting
theme-color, color-scheme, apple-mobile-web-app-capable, -title and
-status-bar-style (plus viewport/description/robots), even when nothing
changed. An installed iPadOS app latches such a runtime change into a
permanently blurred status-bar strip (force-quit resets it). #1014 only
stopped the reader's own value change, so it could not help: the root
tags still churned on each route change. The standalone test apps
(#1009, #1011) never navigate, which is why they were always clean.
theme-color tags are now static children of RootLayout, which
persists across navigations. Verified locally: across two in-app
navigations they are the same DOM nodes with zero mutations; only
Next's own viewport/description/robots tags still churn (no API to
stop that), with identical values.
generateViewportbecomes the staticbaseViewport;themeHeadMeta(lib/viewport.ts) replaces themedViewport/readerViewport.
route declaring them via the metadata/viewport API.
a glance), a document-wide logger that survives in-app navigation
(every change in with old/new values, every change of
the element iOS samples at the top edge, per route), one button per
candidate trigger — including "churn: remove + re-add all app metas",
i.e. exactly the old Next behaviour — a real Reload, and clean/faded
note buttons. Delete with the rest of the lab.
iOS snapshots the apple-* tags at Add-to-Home-Screen time; the values
are unchanged, so no reinstall is needed.