Skip to content

Commit face039

Browse files
AltanSclaude
andcommitted
fix(web): the page draws its own top edge, so an iPad's Home Screen app stops blurring it (#597)
#203 (1.8.1) stopped the iOS 27 top blur on a phone with apple-mobile-web-app-status-bar-style "default". The reporter on an iPad Pro 11 (iPadOS 27.0.1, Collie 1.24.0, `default` in the served index.html) still sees the Collie mark and the COLLIE eyebrow smeared on the dashboard, and the rail mark and the tab row on the wide layout; SPACES and the pane header, one row lower, are sharp. Full screen or windowed, and a fresh Add to Home Screen, change nothing. Why the phone fix does not reach an iPad. #203 changed only the meta tag; the sticky, opaque header does the rest on a phone, where it is 100% of the width. A page cannot switch the system blur off. Field reports say WebKit leaves it out when the page's top edge is a real fixed element, within 4px of the top, at least 6px tall and at least 80% as wide as the viewport, in an opaque colour, and that a pseudo-element does not count (rexdotsh/kleis#97; WebKit bugs 295569 and 317153, where Apple says to drop black-translucent and let the bar take the page colour). Collie's column header stops at max-w-screen-sm, 640px: 77% of a portrait iPad Pro 11 (834pt), 54% in landscape, and on the wide layout the top edge is a 48px rail beside a tab row. Nothing at the top is 80% wide, so there is no edge to sample, and the system blur lands on the first row. That also fits the report: only the first row smears. The change. One real element, [data-slot="top-edge"], before #root in index.html: fixed, inset 0 0 auto 0, pointer-events none, background var(--band-ground) (the header's own token, so it follows every theme and the `chrome: band` word), z-index 25 (over the sticky header, under the strip rung, toasts and sheets), height max(env(safe-area-inset-top), the floor). The floor is 0px, and 6px from 768px wide, for an iPad that reports a 0 inset under `default` and would otherwise give the element no height. Display is none except in a standalone iOS web view (display-mode standalone plus -webkit-touch-callout), the same gate as --app-h. It is out of flow and the header already pads by the inset, so nothing moves. A phone gets no floor and an inset of 0 under `default`: unchanged. The meta tag stays `default`. A page-side change, so no re-add to the Home Screen. Proof and its limit. No iPad here, no WebKit Home Screen launch, and the blur is drawn by the system, so none of it shows the blur. vitest pins the element, the gate, the geometry, the token and the z rung. A Playwright spec reads the shipped rules back through the CSSOM, lifts the gate, and asserts in Chromium (phone and tablet) and WebKit (phone, in the wk distrobox) that the strip is fixed, full width, at y 0, opaque in the header's colour, 0px tall on a phone and 6px at 820, and that the header does not move. The sources are field reports, not an Apple document; the reporter has to confirm on the device. Sources: - https://bugs.webkit.org/show_bug.cgi?id=317153 - https://bugs.webkit.org/show_bug.cgi?id=295569 - https://bugs.webkit.org/show_bug.cgi?id=301994 - rexdotsh/kleis#97 - anomalyco/opencode#56969 - autobrr/qui#2520 Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent 4145129 commit face039

5 files changed

Lines changed: 231 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Running a crew? Update the lead first; members follow on their own. Details:
2525

2626
### Fixed
2727

28+
- **The top strip of the Home Screen app renders sharp on iPad.** An iPad still blurred the Collie mark and the first row of the dashboard, and the rail mark and the tab row on the wide layout, after the 1.8.1 fix for iPhone. That fix lets the header be the page's top edge, and on an iPad no header reaches the full width. Collie now draws its own top edge, one strip across the whole top in the header's colour, in a Home Screen app on iOS and iPadOS only. It follows the theme and moves nothing. An iPhone is unchanged. It is part of the page, so it needs no re-add to the Home Screen. Thanks @Kollapat (#597).
2829
- **The web build passes again as the app grows.** The main chunk passed Workbox's 2 MiB precache limit by a few kilobytes, and the web build, so `collie update` from source, stopped at that step. The limit is now 3 MiB, and the main chunk stays in the offline precache.
2930
- **A held command no longer stays stuck on an idle pane.** On pi, OMP and Codex a command held during a turn waited until Collie saw that turn running. When the turn ended between two reads, the command stayed queued for ten minutes on an idle pane, and every later message waited behind it. It now goes once the agent reads idle with an empty box for two seconds, and still never while the turn runs.
3031
- **A long message to OMP sends in one tap, and a long draft no longer ends half deleted.** OMP shows only the last 17 rows of a long message, so a send of about 2,000 characters or more stopped before Enter. Collie now checks those rows against the end of the text, and the receipt says so. Discard and Replace pressed at most 1,536 Backspaces and could leave part of a draft. They now press as many as the draft has: what the box shows, or for Discard the text Collie typed. Replace refuses a draft that fills the box before it deletes anything, because Collie cannot see how long it is.

‎web/e2e/top-edge.spec.ts‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import { expect, test } from "@playwright/test";
2+
3+
import { installApiStub } from "./fixtures/api";
4+
5+
// THE TOP EDGE OF A HOME-SCREEN APP, laid out by the engine (index.css, "THE TOP EDGE"; #597).
6+
// Playwright cannot emulate a Home Screen launch, an `-webkit-touch-callout` WebView or a safe-area
7+
// inset, and it cannot draw the iOS 27 blur, so this cannot show the iPad case itself. What it does
8+
// prove, in WebKit and Chromium at phone and tablet width: with the standalone gate lifted from the
9+
// SHIPPED stylesheet (read back through the CSSOM, so a rule that moves or breaks fails here), the
10+
// element is a real, fixed, full-width, opaque box at y=0 in the header's own colour, as tall as the
11+
// floor (the inset is 0 in a browser), never in the way of a tap, and it moves nothing.
12+
13+
// NO SERVICE WORKER: `page.route` cannot see a request the worker makes (see composer-clear.spec.ts).
14+
test.use({ serviceWorkers: "block" });
15+
16+
test.beforeEach(async ({ page }, testInfo) => {
17+
test.skip(testInfo.project.name.startsWith("states"), "the playground has no shell");
18+
await installApiStub(page);
19+
});
20+
21+
/** Re-adds the shipped rules that sit behind the standalone iOS gate, without the gate. */
22+
async function liftGate(page: import("@playwright/test").Page): Promise<void> {
23+
await page.evaluate(() => {
24+
const out: string[] = [];
25+
const walk = (rules: CSSRuleList, wrap: string[]): void => {
26+
for (const rule of Array.from(rules)) {
27+
if (rule instanceof CSSStyleRule) {
28+
if (rule.selectorText.includes("top-edge") || rule.cssText.includes("--top-edge-floor")) {
29+
out.push(wrap.reduceRight((inner, outer) => `${outer} { ${inner} }`, rule.cssText));
30+
}
31+
} else if (rule instanceof CSSMediaRule || rule instanceof CSSSupportsRule) {
32+
const cond = rule instanceof CSSMediaRule ? rule.conditionText : "";
33+
const sup = rule instanceof CSSSupportsRule ? rule.conditionText : "";
34+
if (/display-mode|-webkit-touch-callout/u.test(cond + sup)) walk(rule.cssRules, wrap);
35+
else walk(rule.cssRules, [...wrap, `@media ${cond}`]);
36+
}
37+
}
38+
};
39+
for (const sheet of Array.from(document.styleSheets)) walk(sheet.cssRules, []);
40+
const style = document.createElement("style");
41+
style.dataset.lifted = "top-edge";
42+
style.textContent = out.join("\n");
43+
document.head.appendChild(style);
44+
});
45+
}
46+
47+
test("outside a Home Screen app the element draws nothing", async ({ page }) => {
48+
await page.goto("/");
49+
const edge = page.locator('[data-slot="top-edge"]');
50+
await expect(edge).toHaveCount(1);
51+
expect(await edge.evaluate((el) => getComputedStyle(el).display)).toBe("none");
52+
});
53+
54+
test("with the gate lifted it is a fixed, opaque, full-width strip at the top in the header colour", async ({ page }) => {
55+
await page.goto("/");
56+
await expect(page.getByRole("banner")).toBeVisible();
57+
const before = await page.getByRole("banner").boundingBox();
58+
await liftGate(page);
59+
60+
const m = await page.evaluate(() => {
61+
const el = document.querySelector<HTMLElement>('[data-slot="top-edge"]');
62+
const header = document.querySelector("header");
63+
if (el === null || header === null) throw new Error("no strip or no header");
64+
const s = getComputedStyle(el);
65+
const r = el.getBoundingClientRect();
66+
return {
67+
display: s.display,
68+
position: s.position,
69+
pointerEvents: s.pointerEvents,
70+
zIndex: s.zIndex,
71+
bg: s.backgroundColor,
72+
headerBg: getComputedStyle(header).backgroundColor,
73+
x: r.x,
74+
y: r.y,
75+
width: r.width,
76+
height: r.height,
77+
innerWidth: window.innerWidth,
78+
};
79+
});
80+
expect(m.display).toBe("block");
81+
expect(m.position).toBe("fixed");
82+
expect(m.pointerEvents).toBe("none");
83+
expect(Number(m.zIndex)).toBeGreaterThan(20);
84+
expect(m.y).toBe(0);
85+
expect(m.x).toBe(0);
86+
expect(m.width).toBe(m.innerWidth);
87+
// Opaque, and the header's own paint, so the two cannot show a seam.
88+
expect(m.bg).toBe(m.headerBg);
89+
expect(m.bg).not.toMatch(/rgba\(.*,\s*0\)$/u);
90+
// No inset in a browser: a phone gets no floor, a tablet gets the smallest height WebKit accepts.
91+
expect(m.height).toBe(m.innerWidth >= 768 ? 6 : 0);
92+
93+
// It moves nothing: the banner sits where it sat.
94+
const after = await page.getByRole("banner").boundingBox();
95+
expect(after).toEqual(before);
96+
});

‎web/index.html‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@
316316
</style>
317317
</head>
318318
<body>
319+
<!-- The page's own top edge in a Home Screen app (index.css, "THE TOP EDGE"). A real element, not
320+
a pseudo-element, and outside #root so React's createRoot never replaces it. Empty and
321+
invisible everywhere but a standalone iOS web view. -->
322+
<div data-slot="top-edge" aria-hidden="true"></div>
319323
<div id="root">
320324
<div class="boot-splash" role="status" aria-label="Loading Collie">
321325
<span class="boot-splash__mark" aria-hidden="true"></span>

‎web/src/index.css‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,62 @@
11441144
}
11451145
}
11461146

1147+
/* THE TOP EDGE OF A HOME-SCREEN APP, painted by the page (#597, after #203).
1148+
*
1149+
* iOS 26.1 and later draw a system blur over the top of an installed web app, and a page cannot
1150+
* switch it off. WebKit leaves it out when the page's own top edge is a solid, opaque element it can
1151+
* sample: a REAL element (a pseudo-element is ignored), `position: fixed`, within 4px of the top,
1152+
* at least 6px tall and at least 80% as wide as the viewport. Otherwise it falls back to the page
1153+
* colour and blurs the strip. These numbers are field reports (rexdotsh/kleis#97, WebKit bugs
1154+
* 295569 and 317153), not an Apple document, and there is no iPad in the workspace to prove them.
1155+
*
1156+
* #203 took the phone out of that fallback with `apple-mobile-web-app-status-bar-style: default`:
1157+
* the web view starts below an opaque bar, and the header (sticky, opaque, 100% wide below 640px)
1158+
* is the edge. An iPad is wider than the header. The column header stops at `max-w-screen-sm`
1159+
* (640px), 77% of a portrait iPad Pro 11 (834pt) and 54% of it in landscape, and on the wide layout
1160+
* the top edge is a 48px rail beside a tab row. Nothing at the top reaches 80% of the width, so the
1161+
* heuristic finds no edge and the blur washes over the mark and the first row (the reporter's
1162+
* report: the row under it, "SPACES", stays sharp).
1163+
*
1164+
* So the page states the edge itself: one element across the whole top, in the header's own colour
1165+
* (`--band-ground`, which follows the theme), as tall as the top inset. It is `pointer-events:
1166+
* none`, `position: fixed` and out of flow, so it moves nothing; the header already pads by the
1167+
* same inset. On a phone that starts below an opaque bar the inset is 0 and it has no height.
1168+
*
1169+
* THE FLOOR. Where the inset is 0 the strip has no height to sample, and an iPad may report 0 under
1170+
* `default`. From 768px wide it is therefore at least `--top-edge-floor` (6px, the smallest height
1171+
* the heuristic accepts). That covers 6px of page at the very top, where the header and the rail
1172+
* keep at least 2px of air above their 44px controls. A phone gets no floor, so nothing changes
1173+
* there.
1174+
*
1175+
* ONLY IN A STANDALONE iOS WEB VIEW: the same gate as `--app-h` above, so a browser tab, Android and
1176+
* desktop never paint it. z-index 25 is above the sticky header (20) and below the strip rung (30),
1177+
* the toasts (40) and the sheets (50). */
1178+
[data-slot="top-edge"] {
1179+
display: none;
1180+
}
1181+
@media (display-mode: standalone) {
1182+
@supports (-webkit-touch-callout: none) {
1183+
:root {
1184+
--top-edge-floor: 0px;
1185+
}
1186+
@media (min-width: 768px) {
1187+
:root {
1188+
--top-edge-floor: 6px;
1189+
}
1190+
}
1191+
[data-slot="top-edge"] {
1192+
display: block;
1193+
position: fixed;
1194+
inset: 0 0 auto 0;
1195+
z-index: 25;
1196+
height: max(env(safe-area-inset-top, 0px), var(--top-edge-floor));
1197+
background: var(--band-ground);
1198+
pointer-events: none;
1199+
}
1200+
}
1201+
}
1202+
11471203
@layer base {
11481204
* {
11491205
/* Full-strength ring, not /50: halved, the focus indicator measures 1.77:1 in light and 1.87:1

‎web/src/top-edge.test.ts‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { readFileSync } from "node:fs";
2+
import { join } from "node:path";
3+
import { describe, expect, it } from "vitest";
4+
5+
// THE TOP EDGE OF A HOME-SCREEN APP (index.css, "THE TOP EDGE"; #597 after #203). #203 turned off
6+
// the iOS 27 top blur on a phone with `status-bar-style: default`. An iPad kept it, because nothing at
7+
// the top of the page spans the width: the column header stops at 640px and the wide layout opens
8+
// with a rail and a tab row. The page now states the edge itself, one fixed, opaque, real element
9+
// across the whole top. This pins the shape of that element; e2e/top-edge.spec.ts asks a real engine
10+
// to lay it out. Neither can show the blur, which only a Home Screen launch on an iPad draws.
11+
const web = join(import.meta.dirname, "..");
12+
const css = readFileSync(join(import.meta.dirname, "index.css"), "utf8");
13+
const html = readFileSync(join(web, "index.html"), "utf8");
14+
const header = readFileSync(join(import.meta.dirname, "components/app-header.tsx"), "utf8");
15+
16+
/** The text of the rule block that opens at `selector`, up to its closing brace. */
17+
function ruleAfter(selector: string, from = 0): string {
18+
const open = css.indexOf(selector, from);
19+
expect(open).toBeGreaterThan(-1);
20+
return css.slice(open, css.indexOf("}", open));
21+
}
22+
23+
/** Everything the standalone gate holds, from the media query to `@layer base`. */
24+
function gate(): string {
25+
const start = css.indexOf("[data-slot=\"top-edge\"] {\n display: none;");
26+
expect(start).toBeGreaterThan(-1);
27+
return css.slice(start, css.indexOf("@layer base", start));
28+
}
29+
30+
describe("the top edge element", () => {
31+
it("is a real element before #root, hidden from assistive tech", () => {
32+
const edge = html.indexOf('<div data-slot="top-edge" aria-hidden="true"></div>');
33+
expect(edge).toBeGreaterThan(-1);
34+
expect(edge).toBeLessThan(html.indexOf('<div id="root">'));
35+
// Outside #root, so React's createRoot cannot replace it.
36+
expect(html.indexOf("<body>")).toBeLessThan(edge);
37+
});
38+
39+
it("keeps the opaque status bar #203 chose", () => {
40+
expect(html).toMatch(/name="apple-mobile-web-app-status-bar-style"\s+content="default"/);
41+
});
42+
43+
it("is not drawn anywhere but a standalone iOS web view", () => {
44+
expect(ruleAfter('[data-slot="top-edge"] {')).toContain("display: none;");
45+
const g = gate();
46+
expect(g).toContain("@media (display-mode: standalone)");
47+
expect(g.indexOf("@supports (-webkit-touch-callout: none)")).toBeGreaterThan(g.indexOf("display-mode"));
48+
expect(g.indexOf("display: block;")).toBeGreaterThan(g.indexOf("-webkit-touch-callout"));
49+
});
50+
51+
it("spans the width at the top, as tall as the inset, in the header's own colour", () => {
52+
const rule = ruleAfter('[data-slot="top-edge"] {', css.indexOf("@supports (-webkit-touch-callout: none)", css.indexOf('[data-slot="top-edge"] {')));
53+
expect(rule).toContain("position: fixed;");
54+
// top 0, left 0, right 0: the 80% width and 4px from the top the heuristic asks for.
55+
expect(rule).toContain("inset: 0 0 auto 0;");
56+
expect(rule).toContain("height: max(env(safe-area-inset-top, 0px), var(--top-edge-floor));");
57+
// The token follows the theme, and it is the one the header paints (so the two cannot differ).
58+
expect(rule).toContain("background: var(--band-ground);");
59+
expect(header).toContain("bg-band-ground");
60+
expect(rule).toContain("pointer-events: none;");
61+
});
62+
63+
it("sits over the sticky header and under the strip rung, the toasts and the sheets", () => {
64+
const z = /\[data-slot="top-edge"\] \{[^}]*z-index:\s*(\d+);/.exec(gate())?.[1];
65+
expect(Number(z)).toBeGreaterThan(20);
66+
expect(Number(z)).toBeLessThan(30);
67+
});
68+
69+
it("has no floor on a phone and 6px from 768px wide", () => {
70+
const g = gate();
71+
expect(g).toMatch(/:root\s*\{\s*--top-edge-floor:\s*0px;\s*\}/);
72+
expect(g).toMatch(/@media \(min-width: 768px\)\s*\{\s*:root\s*\{\s*--top-edge-floor:\s*6px;/);
73+
});
74+
});

0 commit comments

Comments
 (0)