From 2d3da56907a4d2a08a3951387d505f5dcd2d2cb1 Mon Sep 17 00:00:00 2001 From: iris Date: Sun, 22 Nov 2026 18:14:35 +0100 Subject: [PATCH] hive ui: hide the shell's page heading, which the dashboard showed as a second title --- .../packages/shared/src/app-shell/AppShell.css | 16 ++++++++++++++++ frontend/packages/swarm-ui/src/swarm-ui.css | 13 ------------- .../swarm-ui/test/visually-hidden-css.test.mjs | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 frontend/packages/swarm-ui/test/visually-hidden-css.test.mjs diff --git a/frontend/packages/shared/src/app-shell/AppShell.css b/frontend/packages/shared/src/app-shell/AppShell.css index 406b3f980..0969af67f 100644 --- a/frontend/packages/shared/src/app-shell/AppShell.css +++ b/frontend/packages/shared/src/app-shell/AppShell.css @@ -256,3 +256,19 @@ :root[data-motion="allow"] .shell-body { animation: shell-page-enter 160ms ease; } + +/* Text for a screen reader that is not drawn: the page's `

`. Here, not in a + page's own stylesheet, because every page on the shell draws that `

`: the + hive dashboard has no rule of its own for it and showed it as a second, + large title under the active tab. */ +.ui-visually-hidden { + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; + border: 0; +} diff --git a/frontend/packages/swarm-ui/src/swarm-ui.css b/frontend/packages/swarm-ui/src/swarm-ui.css index 2ba6d57e2..cf05e30aa 100644 --- a/frontend/packages/swarm-ui/src/swarm-ui.css +++ b/frontend/packages/swarm-ui/src/swarm-ui.css @@ -12,16 +12,3 @@ a { color: var(--blue); } - -/* Text for a screen reader that is not drawn: the page's `

`. */ -.ui-visually-hidden { - position: absolute; - width: 1px; - height: 1px; - margin: -1px; - padding: 0; - overflow: hidden; - clip-path: inset(50%); - white-space: nowrap; - border: 0; -} diff --git a/frontend/packages/swarm-ui/test/visually-hidden-css.test.mjs b/frontend/packages/swarm-ui/test/visually-hidden-css.test.mjs new file mode 100644 index 000000000..9c0a977cb --- /dev/null +++ b/frontend/packages/swarm-ui/test/visually-hidden-css.test.mjs @@ -0,0 +1,18 @@ +// The shell's hidden `

` is styled by the shell's own stylesheet, so every +// page on it (the swarm UI and the hive dashboard) hides it. Run by `npm test`. +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { test } from "node:test"; + +const read = (path) => readFileSync(new URL(path, import.meta.url), "utf8"); + +test("the shell's stylesheet hides the page heading it draws", () => { + assert.match( + read("../../shared/src/app-shell/AppShell.css"), + /\.ui-visually-hidden \{[^}]*clip-path: inset\(50%\)/, + ); +}); + +test("a page's own stylesheet doesn't define it a second time", () => { + assert.doesNotMatch(read("../src/swarm-ui.css"), /\.ui-visually-hidden/); +});