mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-12-04 03:07:08 +03:00
Keep the iOS status bar solid in the installed web app (#25140)
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / AMD64 Smoke Test (push) Blocked by required conditions
CI / ARM Build (push) Waiting to run
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / AMD64 Smoke Test (push) Blocked by required conditions
CI / ARM Build (push) Waiting to run
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* Keep the iOS status bar solid in the installed web app Since iOS 26 the system blurs the top of a Home Screen web app, over the top row of buttons, unless an opaque fixed element spans the top of the page. Add a thin fixed strip in the background colour so WebKit fills the status bar with it instead. * Require a fully opaque strip background in the status bar test * Show the status bar strip only on iOS The blur it works around is WebKit's. On an installed Android app the strip only covered the top of the page. * Drop the Android status bar strip test It failed on any fixed element at the top of the page, not just the strip.
This commit is contained in:
@@ -172,4 +172,43 @@ test.describe("Navigation — mobile @critical @mobile", () => {
|
|||||||
frigateApp.page.locator('a[href="/review"]').first(),
|
frigateApp.page.locator('a[href="/review"]').first(),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// iOS 26+ blurs the top of a Home Screen web app unless WebKit finds an
|
||||||
|
// opaque, fixed box at least 90% wide, 4px below the top centre
|
||||||
|
test("installed app has an opaque fixed strip under the status bar", async ({
|
||||||
|
frigateApp,
|
||||||
|
}) => {
|
||||||
|
test.skip(!frigateApp.isMobile, "Mobile-only");
|
||||||
|
await frigateApp.page.addInitScript(() => {
|
||||||
|
Object.defineProperty(window.navigator, "standalone", { value: true });
|
||||||
|
});
|
||||||
|
await frigateApp.goto("/");
|
||||||
|
const strip = await frigateApp.page.evaluate(() => {
|
||||||
|
// WebKit's hit test ignores pointer-events, elementFromPoint does not
|
||||||
|
const x = window.innerWidth / 2;
|
||||||
|
const el = Array.from(document.querySelectorAll("body *")).find((e) => {
|
||||||
|
const r = e.getBoundingClientRect();
|
||||||
|
return (
|
||||||
|
getComputedStyle(e).position == "fixed" &&
|
||||||
|
r.left <= x &&
|
||||||
|
r.right >= x &&
|
||||||
|
r.top <= 4 &&
|
||||||
|
r.bottom > 6
|
||||||
|
);
|
||||||
|
});
|
||||||
|
if (!el) return null;
|
||||||
|
const style = getComputedStyle(el);
|
||||||
|
return {
|
||||||
|
widthShare: el.getBoundingClientRect().width / window.innerWidth,
|
||||||
|
background: style.backgroundColor,
|
||||||
|
opacity: style.opacity,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
expect(strip).not.toBeNull();
|
||||||
|
expect(strip!.widthShare).toBeGreaterThan(0.9);
|
||||||
|
// WebKit blends a colour below 0.75 alpha with the page; require solid
|
||||||
|
const alpha = strip!.background.match(/rgba?\(([^)]+)\)/)![1].split(",")[3];
|
||||||
|
expect(Number(alpha ?? 1)).toBe(1);
|
||||||
|
expect(Number(strip!.opacity)).toBe(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+6
-1
@@ -4,7 +4,7 @@ import Wrapper from "@/components/Wrapper";
|
|||||||
import Sidebar from "@/components/navigation/Sidebar";
|
import Sidebar from "@/components/navigation/Sidebar";
|
||||||
import CommandMenu from "@/components/menu/CommandMenu";
|
import CommandMenu from "@/components/menu/CommandMenu";
|
||||||
|
|
||||||
import { isDesktop, isMobile } from "react-device-detect";
|
import { isDesktop, isIOS, isMobile } from "react-device-detect";
|
||||||
import Statusbar from "./components/Statusbar";
|
import Statusbar from "./components/Statusbar";
|
||||||
import Bottombar from "./components/navigation/Bottombar";
|
import Bottombar from "./components/navigation/Bottombar";
|
||||||
import { lazy, useContext, useEffect, useState } from "react";
|
import { lazy, useContext, useEffect, useState } from "react";
|
||||||
@@ -113,6 +113,11 @@ function DefaultAppView() {
|
|||||||
<ChromeErrorBoundary>{isDesktop && <Statusbar />}</ChromeErrorBoundary>
|
<ChromeErrorBoundary>{isDesktop && <Statusbar />}</ChromeErrorBoundary>
|
||||||
<ChromeErrorBoundary>{isDesktop && <CommandMenu />}</ChromeErrorBoundary>
|
<ChromeErrorBoundary>{isDesktop && <CommandMenu />}</ChromeErrorBoundary>
|
||||||
<ChromeErrorBoundary>{isMobile && <Bottombar />}</ChromeErrorBoundary>
|
<ChromeErrorBoundary>{isMobile && <Bottombar />}</ChromeErrorBoundary>
|
||||||
|
{isIOS && isPWA && (
|
||||||
|
// iOS 26+ blurs the top of a Home Screen web app unless an opaque,
|
||||||
|
// fixed, full-width box sits under the status bar
|
||||||
|
<div className="pointer-events-none fixed inset-x-0 top-0 z-50 h-2 bg-background landscape:hidden" />
|
||||||
|
)}
|
||||||
<div
|
<div
|
||||||
id="pageRoot"
|
id="pageRoot"
|
||||||
className={cn(
|
className={cn(
|
||||||
|
|||||||
Reference in New Issue
Block a user