Progmasoft Git

progmaweb

The site and account service of Progmasoft: a Next.js frontend and an ASP.NET Core API.

Clonegit clone https://git.progmasoft.com/progmaweb

Fit every page to phones and test the layout with Playwright

On a phone the header hid every link but the account button, so the
organization site had no way to its products or developer pages, and the
ViGet, Account and Console headers wrapped onto two or three lines.

- HeaderMenu: below 980px the header holds the brand and a menu button;
  the button opens the links and the preferences as a panel under the
  header (48px rows, 44px controls). Escape, a chosen link or a second
  press closes it. Below 420px the button keeps only its icon, so a brand
  with a product name ("Console", "Account") is never covered. All three
  headers (site, ViGet, credentials) use it; ViGet's own column layout is
  gone. Labels in every locale.
- Header links on wide screens get 10px of vertical padding: the same look,
  40px targets.
- The consent checkbox is 24px.
- product.progmasoft.com: below 560px each project row is a card with
  labelled facts instead of a table that scrolled sideways.
- progmasoft.com: the area tiles beside the hero repeated the list right
  below it; they are hidden once the hero is one column. The OAuth sample
  wraps on phones instead of being cut off.

@playwright/test 1.65.0 runs the built site (next start) in Chromium at
360, 390, 768 and 1280px. Every public host name resolves to the local
server through --host-resolver-rules, so no request leaves the machine.
For one page of each kind on every host it checks: no horizontal scroll,
nothing past the screen edge outside a scrolling box, controls of at least
24 by 24px (WCAG 2.2, 2.5.8), the header on one line with brand and
controls not covering each other; and that the phone menu opens and closes.
The Frontend workflow installs Chromium and runs it after the build,
keeping the report and traces when it fails. 140 tests pass locally; with
the 420px rule removed the overlap check fails on Account and Console.

Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
Commit
537b1f3a4a605b7aa980eec520628ff37648f683
Author
Leitwolf11 ·
Parents
1d669cd07fa4

Files · Download .tar.gz

Changes

 .github/workflows/frontend.yml                     |  17 +-
 .gitignore                                         |   4 +
 README.md                                          |   6 +
 apps/web/app/globals.css                           | 189 ++++++++++++++++++---
 apps/web/app/products/catalog.css                  |  53 ++++++
 apps/web/app/site.css                              |  15 +-
 apps/web/app/viget.css                             |  19 ---
 apps/web/components/HeaderMenu.tsx                 |  66 +++++++
 apps/web/components/ProductCatalog.tsx             |  12 +-
 apps/web/components/SiteHeader.tsx                 |   9 +-
 apps/web/components/ViGetHeader.tsx                |   9 +-
 .../components/credentials/CredentialsShell.tsx    |   9 +-
 apps/web/e2e/layout.spec.ts                        | 143 ++++++++++++++++
 apps/web/e2e/pages.ts                              |  28 +++
 apps/web/lib/localization.ts                       |   8 +
 apps/web/package.json                              |   4 +-
 apps/web/playwright.config.ts                      |  57 +++++++
 package.json                                       |   1 +
 pnpm-lock.yaml                                     |  33 +++-
 19 files changed, 615 insertions(+), 67 deletions(-)

diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml
index 0d40b4c..fe0bbf3 100644
--- a/.github/workflows/frontend.yml
+++ b/.github/workflows/frontend.yml
@@ -31,7 +31,7 @@ concurrency:
 jobs:
   verify:
     runs-on: ubuntu-latest
-    timeout-minutes: 15
+    timeout-minutes: 25
     steps:
       - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
         with:
@@ -49,6 +49,21 @@ jobs:
       - run: pnpm lint
       - run: pnpm build
 
+      # Layout tests of the built site in Chromium at phone, tablet and desktop
+      # widths: nothing past the screen edge, headers on one line, targets of
+      # at least 24px, the header menu working.
+      - name: Install Chromium for Playwright
+        run: pnpm --filter @progmasoft/web exec playwright install --with-deps chromium
+      - run: pnpm test:layout
+      - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+        if: failure()
+        with:
+          name: progmaweb-layout-report
+          path: |
+            apps/web/playwright-report/
+            apps/web/test-results/
+          retention-days: 7
+
       - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
         with:
           name: progmaweb-frontend-coverage
diff --git a/.gitignore b/.gitignore
index cb39ae9..442a080 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,7 @@ obj/
 # DocFX output
 docs/api/_site/
 docs/api/reference/
+
+# Playwright layout tests
+apps/web/test-results/
+apps/web/playwright-report/
diff --git a/README.md b/README.md
index 78e6155..2656c1e 100644
--- a/README.md
+++ b/README.md
@@ -93,6 +93,8 @@ pnpm check
 pnpm test
 pnpm test:coverage
 pnpm build
+pnpm --filter @progmasoft/web exec playwright install chromium
+pnpm test:layout
 dotnet build apps/api/Progmaweb.Api.csproj --configuration Release
 dotnet test --project apps/api-tests/Progmaweb.Api.Tests.csproj --configuration Release
 dotnet test --project apps/api-tests/Progmaweb.Api.Tests.csproj --configuration Release --coverlet --coverlet-output-format cobertura
@@ -102,6 +104,10 @@ dotnet run docs/api/CheckDocumentation.cs -- docs/api
 ```
 
 Frontend tests exercise the published locale contract and account/ViGet metadata without starting a production service.
+`pnpm test:layout` runs the built site with `next start` and opens one page of each kind on every host in Chromium at
+360, 390, 768 and 1280 pixels; every host name resolves to the local server, so no request leaves the machine. It
+fails when anything reaches past the edge of the screen, a header takes more than one line or covers its own brand,
+a control is smaller than 24 by 24 pixels, or the header menu of a phone does not open and close.
 The frontend LCOV and API Cobertura reports are retained as one-day artifacts, then uploaded to Codecov by separate
 jobs. Only those upload jobs receive `id-token: write`; dependency installation, builds, and tests do not receive OIDC
 permissions, and fork-originated pull requests skip the upload jobs. CodeQL and Codacy provide static analysis;
diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css
index 9faf511..0654f32 100644
--- a/apps/web/app/globals.css
+++ b/apps/web/app/globals.css
@@ -256,6 +256,164 @@ a {
   font-weight: 600;
 }
 
+/* The links keep their look; the padding makes each one a target of 40px. */
+.primary-nav > a:not(.button) {
+  padding-block: 10px;
+}
+
+/* The header menu: on a wide screen only the navigation shows, in the header
+   line; below 980px the header holds the brand and a menu button, and the
+   navigation opens as a panel under it. */
+.header-menu {
+  display: flex;
+  align-items: center;
+  min-width: 0;
+}
+
+.menu-toggle {
+  display: none;
+}
+
+@media (max-width: 980px) {
+  .header-inner {
+    gap: 12px;
+  }
+
+  .header-inner .brand {
+    min-width: 0;
+  }
+
+  .menu-toggle {
+    min-height: 44px;
+    display: inline-flex;
+    flex: 0 0 auto;
+    align-items: center;
+    gap: 10px;
+    border: 1px solid var(--line);
+    border-radius: var(--radius-sm);
+    padding: 0 14px;
+    background: var(--surface);
+    color: var(--ink-800);
+    cursor: pointer;
+    font-size: 14px;
+    font-weight: 700;
+  }
+
+  .menu-toggle:hover {
+    border-color: var(--blue-600);
+    background: var(--surface-blue);
+  }
+
+  .menu-toggle-bars,
+  .menu-toggle-bars::before,
+  .menu-toggle-bars::after {
+    width: 16px;
+    height: 2px;
+    display: block;
+    border-radius: 1px;
+    background: currentcolor;
+  }
+
+  .menu-toggle-bars {
+    position: relative;
+  }
+
+  .menu-toggle-bars::before,
+  .menu-toggle-bars::after {
+    position: absolute;
+    left: 0;
+    content: "";
+  }
+
+  .menu-toggle-bars::before {
+    top: -5px;
+  }
+
+  .menu-toggle-bars::after {
+    top: 5px;
+  }
+
+  .header-menu[data-open="true"] .menu-toggle-bars {
+    background: transparent;
+  }
+
+  .header-menu[data-open="true"] .menu-toggle-bars::before {
+    top: 0;
+    transform: rotate(45deg);
+  }
+
+  .header-menu[data-open="true"] .menu-toggle-bars::after {
+    top: 0;
+    transform: rotate(-45deg);
+  }
+
+  .header-menu .primary-nav {
+    position: absolute;
+    top: 100%;
+    right: 0;
+    left: 0;
+    display: none;
+    flex-direction: column;
+    align-items: stretch;
+    gap: 0;
+    border-bottom: 1px solid var(--line);
+    padding: 6px max(14px, calc((100% - var(--shell)) / 2)) 18px;
+    background: var(--surface);
+    box-shadow: var(--shadow-md);
+  }
+
+  .header-menu[data-open="true"] .primary-nav {
+    display: flex;
+  }
+
+  .header-menu .primary-nav > a:not(.button) {
+    min-height: 48px;
+    display: flex;
+    align-items: center;
+    border-bottom: 1px solid var(--line);
+    font-size: 16px;
+  }
+
+  .header-menu .primary-nav > .button {
+    min-height: 44px;
+    justify-content: center;
+    margin-top: 16px;
+  }
+
+  .header-menu .preference-controls {
+    padding: 16px 0 0;
+  }
+
+  .header-menu .preference-controls button,
+  .header-menu .preference-controls select {
+    min-height: 44px;
+    font-size: 14px;
+  }
+
+  .header-menu .preference-controls select {
+    flex: 1 1 auto;
+  }
+}
+
+/* A brand with a product name leaves no room for the word on a narrow phone:
+   the button keeps its icon and its accessible name. */
+@media (max-width: 420px) {
+  .menu-toggle {
+    width: 44px;
+    justify-content: center;
+    padding: 0;
+  }
+
+  .menu-toggle-text {
+    position: absolute;
+    width: 1px;
+    height: 1px;
+    overflow: hidden;
+    clip-path: inset(50%);
+    white-space: nowrap;
+  }
+}
+
 .primary-nav > a:hover {
   color: var(--blue-600);
   text-decoration: none;
@@ -990,9 +1148,9 @@ a {
 
 .consent-field input {
   flex: none;
-  width: 18px;
-  height: 18px;
-  margin: 2px 0 0;
+  width: 24px;
+  height: 24px;
+  margin: -1px 0 0;
   accent-color: var(--violet-600);
 }
 
@@ -1300,14 +1458,6 @@ a {
     min-height: 60px;
   }
 
-  .primary-nav > a:not(.button) {
-    display: none;
-  }
-
-  .preference-controls button span:last-child {
-    display: none;
-  }
-
   .hero-grid {
     min-height: auto;
     grid-template-columns: minmax(0, 1fr);
@@ -1433,23 +1583,6 @@ a {
   unicode-bidi: isolate;
 }
 
-/* A phone keeps the brand, the account button and both preferences on one
-   line: the gaps shrink, and the line may wrap rather than widen the page. */
-@media (max-width: 480px) {
-  .header-inner {
-    flex-wrap: wrap;
-    gap: 8px 12px;
-  }
-
-  .primary-nav {
-    gap: 10px;
-  }
-
-  .preference-controls {
-    padding-left: 0;
-  }
-}
-
 /* The theme changes in one frame; nothing animates its colours meanwhile. */
 .theme-switching,
 .theme-switching *,
diff --git a/apps/web/app/products/catalog.css b/apps/web/app/products/catalog.css
index cfeda60..9395893 100644
--- a/apps/web/app/products/catalog.css
+++ b/apps/web/app/products/catalog.css
@@ -264,6 +264,59 @@
     grid-template-columns: 1fr;
   }
 
+  /* On a phone each project is a card: its name and tagline, then one line
+     per fact, labelled from the column it came from. */
+  .pm-table,
+  .pm-table tbody,
+  .pm-table tr,
+  .pm-table th,
+  .pm-table td {
+    display: block;
+  }
+
+  .pm-table thead {
+    position: absolute;
+    width: 1px;
+    height: 1px;
+    overflow: hidden;
+    clip-path: inset(50%);
+    white-space: nowrap;
+  }
+
+  .pm-table tr {
+    border-block-end: 1px solid var(--line);
+    padding-block: 14px;
+  }
+
+  .pm-table tbody tr:last-child {
+    border-block-end: 0;
+  }
+
+  .pm-table tbody th {
+    min-inline-size: 0;
+    padding-block: 0 8px;
+  }
+
+  .pm-table th,
+  .pm-table td {
+    border-block-end: 0;
+  }
+
+  .pm-table td {
+    display: grid;
+    grid-template-columns: minmax(96px, 35%) minmax(0, 1fr);
+    justify-items: start;
+    gap: 12px;
+    padding-block: 4px;
+  }
+
+  .pm-table td::before {
+    color: var(--ink-650);
+    content: attr(data-label);
+    font-size: 13px;
+    font-weight: 700;
+  }
+
   .pm-stats {
     grid-template-columns: repeat(2, minmax(0, 1fr));
   }
diff --git a/apps/web/app/site.css b/apps/web/app/site.css
index 3ee84bd..58106e3 100644
--- a/apps/web/app/site.css
+++ b/apps/web/app/site.css
@@ -502,6 +502,10 @@
     grid-column: auto;
   }
 
+  .pm-pool-visual {
+    display: none;
+  }
+
   .pm-band {
     padding: 36px 26px;
   }
@@ -512,12 +516,11 @@
 }
 
 @media (max-width: 560px) {
-  .pm-pool-visual {
-    grid-template-columns: 1fr;
-  }
-
-  .pm-pool-tile:nth-child(even) {
-    transform: none;
+  .pm-code {
+    padding: 18px;
+    font-size: 13px;
+    white-space: pre-wrap;
+    overflow-wrap: anywhere;
   }
 }
 
diff --git a/apps/web/app/viget.css b/apps/web/app/viget.css
index 1f12aa1..fe6f196 100644
--- a/apps/web/app/viget.css
+++ b/apps/web/app/viget.css
@@ -280,17 +280,6 @@ a.viget-catalog-card:hover {
 }
 
 @media (max-width: 980px) {
-  .viget-header .header-inner {
-    align-items: flex-start;
-    flex-direction: column;
-    padding-block: 16px;
-  }
-
-  .viget-header .primary-nav {
-    width: 100%;
-    flex-wrap: wrap;
-  }
-
   .viget-hero-grid,
   .viget-plugin-grid,
   .viget-contract-grid {
@@ -305,14 +294,6 @@ a.viget-catalog-card:hover {
 }
 
 @media (max-width: 680px) {
-  .viget-header .primary-nav {
-    gap: 14px;
-  }
-
-  .viget-header .primary-nav > a:not(.button) {
-    display: inline-flex;
-  }
-
   .viget-hero-grid,
   .viget-plugin-grid {
     padding-block: 56px;
diff --git a/apps/web/components/HeaderMenu.tsx b/apps/web/components/HeaderMenu.tsx
new file mode 100644
index 0000000..6ad8145
--- /dev/null
+++ b/apps/web/components/HeaderMenu.tsx
@@ -0,0 +1,66 @@
+// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+"use client";
+
+import { useEffect, useId, useState, type ReactNode } from "react";
+
+interface HeaderMenuProps {
+  children: ReactNode;
+  closeLabel: string;
+  label: string;
+  menuLabel: string;
+}
+
+/**
+ * The navigation of a site header.
+ *
+ * A wide screen shows the links in the header line and never shows the menu
+ * button. A phone shows the brand and the menu button; the button opens the
+ * links and the preferences as a panel under the header. A link chosen in the
+ * panel, the Escape key and a second press of the button close it.
+ */
+export function HeaderMenu({
+  children,
+  closeLabel,
+  label,
+  menuLabel,
+}: HeaderMenuProps) {
+  const [open, setOpen] = useState(false);
+  const panelId = useId();
+
+  useEffect(() => {
+    if (!open) return;
+    const onKey = (event: KeyboardEvent) => {
+      if (event.key === "Escape") setOpen(false);
+    };
+    window.addEventListener("keydown", onKey);
+    return () => window.removeEventListener("keydown", onKey);
+  }, [open]);
+
+  return (
+    <div className="header-menu" data-open={open ? "true" : "false"}>
+      <button
+        aria-controls={panelId}
+        aria-expanded={open}
+        aria-label={open ? closeLabel : menuLabel}
+        className="menu-toggle"
+        onClick={() => setOpen((value) => !value)}
+        type="button"
+      >
+        <span aria-hidden="true" className="menu-toggle-bars" />
+        <span className="menu-toggle-text">{menuLabel}</span>
+      </button>
+      <nav
+        aria-label={label}
+        className="primary-nav"
+        id={panelId}
+        onClick={(event) => {
+          if ((event.target as HTMLElement).closest("a")) setOpen(false);
+        }}
+      >
+        {children}
+      </nav>
+    </div>
+  );
+}
diff --git a/apps/web/components/ProductCatalog.tsx b/apps/web/components/ProductCatalog.tsx
index 73ec001..860294b 100644
--- a/apps/web/components/ProductCatalog.tsx
+++ b/apps/web/components/ProductCatalog.tsx
@@ -124,12 +124,16 @@ export function ProductTable({
                   <a href={`/${slug}`}>{product.name}</a>
                   <span>{catalog.products[slug].tagline}</span>
                 </th>
-                <td>{catalog.categories[product.category]}</td>
-                <td dir="ltr">{product.language}</td>
-                <td>
+                <td data-label={catalog.table.category}>
+                  {catalog.categories[product.category]}
+                </td>
+                <td data-label={catalog.table.language}>
+                  <bdi dir="ltr">{product.language}</bdi>
+                </td>
+                <td data-label={catalog.table.status}>
                   <StatusBadge status={product.status} catalog={catalog} />
                 </td>
-                <td>
+                <td data-label={catalog.table.release}>
                   {release ? (
                     <a href={release.url}>
                       <bdi>{release.version}</bdi> ·{" "}
diff --git a/apps/web/components/SiteHeader.tsx b/apps/web/components/SiteHeader.tsx
index 6151def..bf46ade 100644
--- a/apps/web/components/SiteHeader.tsx
+++ b/apps/web/components/SiteHeader.tsx
@@ -5,6 +5,7 @@ import Link from "next/link";
 import { getHomeMessages } from "@/lib/home-messages";
 import { getMessages, type Locale } from "@/lib/localization";
 import { Brand } from "./Brand";
+import { HeaderMenu } from "./HeaderMenu";
 import { PreferenceControls } from "./PreferenceControls";
 
 interface SiteHeaderProps {
@@ -24,7 +25,11 @@ export function SiteHeader({
     <header className="site-header">
       <div className="shell header-inner">
         <Brand account={account} accountLabel={navigation.account} />
-        <nav className="primary-nav" aria-label={navigation.primary}>
+        <HeaderMenu
+          closeLabel={navigation.closeMenu}
+          label={navigation.primary}
+          menuLabel={navigation.menu}
+        >
           {account ? (
             <>
               <Link href="https://progmasoft.com/">
@@ -61,7 +66,7 @@ export function SiteHeader({
             </>
           )}
           <PreferenceControls locale={locale} labels={navigation} />
-        </nav>
+        </HeaderMenu>
       </div>
     </header>
   );
diff --git a/apps/web/components/ViGetHeader.tsx b/apps/web/components/ViGetHeader.tsx
index f34dfd6..796ffa1 100644
--- a/apps/web/components/ViGetHeader.tsx
+++ b/apps/web/components/ViGetHeader.tsx
@@ -4,6 +4,7 @@
 import Link from "next/link";
 import { getMessages, type Locale } from "@/lib/localization";
 import { Brand } from "./Brand";
+import { HeaderMenu } from "./HeaderMenu";
 import { PreferenceControls } from "./PreferenceControls";
 
 export function ViGetHeader({ locale }: { locale: Locale }) {
@@ -15,7 +16,11 @@ export function ViGetHeader({ locale }: { locale: Locale }) {
           <Brand />
           <span>ViGet</span>
         </div>
-        <nav className="primary-nav" aria-label={viget.navigationLabel}>
+        <HeaderMenu
+          closeLabel={navigation.closeMenu}
+          label={viget.navigationLabel}
+          menuLabel={navigation.menu}
+        >
           <Link href="https://viget.progmasoft.com/#languages-title">
             {viget.packages}
           </Link>
@@ -30,7 +35,7 @@ export function ViGetHeader({ locale }: { locale: Locale }) {
             {viget.register}
           </Link>
           <PreferenceControls locale={locale} labels={navigation} />
-        </nav>
+        </HeaderMenu>
       </div>
     </header>
   );
diff --git a/apps/web/components/credentials/CredentialsShell.tsx b/apps/web/components/credentials/CredentialsShell.tsx
index 5978e85..2193572 100644
--- a/apps/web/components/credentials/CredentialsShell.tsx
+++ b/apps/web/components/credentials/CredentialsShell.tsx
@@ -6,6 +6,7 @@ import { getCredentialsMessages } from "@/lib/credentials-messages";
 import { siteOrigin, type OAuthSite } from "@/lib/hosts.server";
 import { getMessages, type Locale } from "@/lib/localization";
 import { Brand } from "../Brand";
+import { HeaderMenu } from "../HeaderMenu";
 import { PreferenceControls } from "../PreferenceControls";
 
 interface CredentialsShellProps {
@@ -58,7 +59,11 @@ export async function CredentialsShell({
             accountLabel={site === "console" ? common.console : "OAuth"}
             home="/"
           />
-          <nav className="primary-nav" aria-label={navigation.primary}>
+          <HeaderMenu
+            closeLabel={navigation.closeMenu}
+            label={navigation.primary}
+            menuLabel={navigation.menu}
+          >
             <a href="https://progmasoft.com/">{common.organization}</a>
             <a href={`${authorizeOrigin}/account/applications`}>
               {common.allowedApplications}
@@ -70,7 +75,7 @@ export async function CredentialsShell({
               {common.developers}
             </a>
             <PreferenceControls locale={locale} labels={navigation} />
-          </nav>
+          </HeaderMenu>
         </div>
       </header>
       {layout === "split" ? (
diff --git a/apps/web/e2e/layout.spec.ts b/apps/web/e2e/layout.spec.ts
new file mode 100644
index 0000000..8c6ac91
--- /dev/null
+++ b/apps/web/e2e/layout.spec.ts
@@ -0,0 +1,143 @@
+// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import { expect, test, type Page } from "@playwright/test";
+import { layoutPages } from "./pages";
+
+/** The widest screen that shows the header menu button instead of the links. */
+const menuWidth = 980;
+
+async function open(page: Page, target: string) {
+  const response = await page.goto(`http://${target}`);
+  expect(response?.status(), `status of ${target}`).toBeLessThan(400);
+}
+
+/**
+ * Elements that reach past either edge of the viewport, outside any box that
+ * scrolls or clips them. One such element is enough for a phone to scroll
+ * sideways or to cut text off.
+ */
+function elementsPastTheEdges(page: Page) {
+  return page.evaluate(() => {
+    const width = document.documentElement.clientWidth;
+    const clipped = (element: Element) => {
+      for (
+        let p = element.parentElement;
+        p && p !== document.body;
+        p = p.parentElement
+      ) {
+        if (getComputedStyle(p).overflowX !== "visible") return true;
+      }
+      return false;
+    };
+    const found: string[] = [];
+    for (const element of document.body.querySelectorAll("*")) {
+      const box = element.getBoundingClientRect();
+      if (box.width === 0 || box.height === 0) continue;
+      if (box.right <= width + 1 && box.left >= -1) continue;
+      if (clipped(element)) continue;
+      found.push(
+        `${element.tagName.toLowerCase()}.${String(element.className)} ${Math.round(box.left)}..${Math.round(box.right)}`,
+      );
+    }
+    return found;
+  });
+}
+
+/**
+ * Controls smaller than 24 by 24 CSS pixels, the minimum target size of WCAG
+ * 2.2 (2.5.8). Links inside running text are exempt, as WCAG exempts them.
+ */
+function smallControls(page: Page) {
+  return page.evaluate(() => {
+    const controls = document.querySelectorAll(
+      "button, select, input:not([type=hidden]), .button, header a, .primary-nav a",
+    );
+    const found: string[] = [];
+    for (const control of controls) {
+      const box = control.getBoundingClientRect();
+      if (box.width === 0 || box.height === 0) continue;
+      if (box.width < 24 || box.height < 24) {
+        found.push(
+          `${control.tagName.toLowerCase()} "${control.textContent?.trim().slice(0, 24)}" ${Math.round(box.width)}x${Math.round(box.height)}`,
+        );
+      }
+    }
+    return found;
+  });
+}
+
+for (const target of layoutPages) {
+  test(`${target} fits the screen`, async ({ page }) => {
+    await open(page, target);
+    const overflow = await page.evaluate(
+      () =>
+        document.documentElement.scrollWidth -
+        document.documentElement.clientWidth,
+    );
+    expect(overflow, "horizontal scroll").toBe(0);
+    expect(await elementsPastTheEdges(page)).toEqual([]);
+    expect(await smallControls(page)).toEqual([]);
+  });
+
+  test(`${target} keeps its header on one line`, async ({ page }) => {
+    await open(page, target);
+    const header = page.locator("header.site-header").first();
+    test.skip((await header.count()) === 0, "the page has no site header");
+    const box = await header.boundingBox();
+    expect(box?.height ?? 0).toBeLessThanOrEqual(80);
+    // The brand and the controls beside it must not cover each other.
+    const overlaps = await header.evaluate((element) => {
+      // The words of the brand are measured themselves: a squeezed brand box
+      // can be narrower than the text that spills out of it.
+      const parts = [
+        ...element.querySelectorAll(
+          ".brand-name, .brand-product, .viget-brand-lockup > span, .menu-toggle, .primary-nav > *",
+        ),
+      ]
+        .map((part) => ({ part, box: part.getBoundingClientRect() }))
+        .filter(({ box }) => box.width > 0 && box.height > 0);
+      const found: string[] = [];
+      for (const [i, a] of parts.entries()) {
+        for (const b of parts.slice(i + 1)) {
+          if (a.part.contains(b.part) || b.part.contains(a.part)) continue;
+          const x =
+            Math.min(a.box.right, b.box.right) -
+            Math.max(a.box.left, b.box.left);
+          const y =
+            Math.min(a.box.bottom, b.box.bottom) -
+            Math.max(a.box.top, b.box.top);
+          if (x > 1 && y > 1)
+            found.push(`${a.part.className} / ${b.part.className}`);
+        }
+      }
+      return found;
+    });
+    expect(overlaps).toEqual([]);
+  });
+}
+
+test("the header menu opens and closes on a phone", async ({ page }) => {
+  const width = page.viewportSize()?.width ?? 0;
+  test.skip(width > menuWidth, "wide screens show the links in the header");
+  await open(page, "progmasoft.com/");
+  const toggle = page.locator(".menu-toggle");
+  const links = page.locator(".primary-nav a").first();
+  await expect(toggle).toBeVisible();
+  await expect(links).toBeHidden();
+  await toggle.click();
+  await expect(toggle).toHaveAttribute("aria-expanded", "true");
+  await expect(links).toBeVisible();
+  expect(await elementsPastTheEdges(page)).toEqual([]);
+  await page.keyboard.press("Escape");
+  await expect(toggle).toHaveAttribute("aria-expanded", "false");
+  await expect(links).toBeHidden();
+});
+
+test("wide screens show the links without a menu button", async ({ page }) => {
+  const width = page.viewportSize()?.width ?? 0;
+  test.skip(width <= menuWidth, "phones and tablets use the menu");
+  await open(page, "progmasoft.com/");
+  await expect(page.locator(".menu-toggle")).toBeHidden();
+  await expect(page.locator(".primary-nav a").first()).toBeVisible();
+});
diff --git a/apps/web/e2e/pages.ts b/apps/web/e2e/pages.ts
new file mode 100644
index 0000000..6d95f77
--- /dev/null
+++ b/apps/web/e2e/pages.ts
@@ -0,0 +1,28 @@
+// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+/** The public pages the layout tests open, one per kind of page on each host. */
+export const layoutPages = [
+  "progmasoft.com/",
+  "progmasoft.com/privacy",
+  "progmasoft.com/security",
+  "account.progmasoft.com/",
+  "account.progmasoft.com/login",
+  "account.progmasoft.com/register",
+  "viget.progmasoft.com/",
+  "viget.progmasoft.com/langs/cpp",
+  "viget.progmasoft.com/dslplugins/tazel",
+  "product.progmasoft.com/",
+  "product.progmasoft.com/categories",
+  "product.progmasoft.com/languages",
+  "product.progmasoft.com/releases",
+  "product.progmasoft.com/tazel",
+  "product.progmasoft.com/catch3",
+  "console.progmasoft.com/",
+  "catch3.uk/",
+] as const;
+
+/** Every host name of the pages above. */
+export const layoutHosts = [
+  ...new Set(layoutPages.map((page) => page.slice(0, page.indexOf("/")))),
+];
diff --git a/apps/web/lib/localization.ts b/apps/web/lib/localization.ts
index ee70136..f2a012f 100644
--- a/apps/web/lib/localization.ts
+++ b/apps/web/lib/localization.ts
@@ -156,6 +156,8 @@ export const messages = {
       dashboard: "Dashboard",
       signIn: "Sign in",
       createAccount: "Create account",
+      menu: "Menu",
+      closeMenu: "Close the menu",
       theme: "Theme",
       light: "Light",
       dark: "Dark",
@@ -415,6 +417,8 @@ export const messages = {
       dashboard: "Übersicht",
       signIn: "Anmelden",
       createAccount: "Konto erstellen",
+      menu: "Menü",
+      closeMenu: "Menü schließen",
       theme: "Darstellung",
       light: "Hell",
       dark: "Dunkel",
@@ -678,6 +682,8 @@ export const messages = {
       dashboard: "Панель управления",
       signIn: "Войти",
       createAccount: "Создать аккаунт",
+      menu: "Меню",
+      closeMenu: "Закрыть меню",
       theme: "Тема",
       light: "Светлая",
       dark: "Тёмная",
@@ -940,6 +946,8 @@ export const messages = {
       dashboard: "לוח בקרה",
       signIn: "כניסה",
       createAccount: "יצירת חשבון",
+      menu: "תפריט",
+      closeMenu: "סגירת התפריט",
       theme: "ערכת נושא",
       light: "בהיר",
       dark: "כהה",
diff --git a/apps/web/package.json b/apps/web/package.json
index 41b503f..dd2912b 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -15,7 +15,8 @@
     "test": "node --experimental-strip-types --test tests/*.test.mjs",
     "test:coverage": "c8 --reporter=lcov --reporter=text npm test",
     "lint": "eslint . --max-warnings=0",
-    "format": "prettier --write ."
+    "format": "prettier --write .",
+    "test:layout": "playwright test"
   },
   "dependencies": {
     "next": "16.4.5",
@@ -23,6 +24,7 @@
     "react-dom": "19.3.1"
   },
   "devDependencies": {
+    "@playwright/test": "1.65.0",
     "@types/node": "24.19.2",
     "@types/react": "19.3.0",
     "@types/react-dom": "19.3.0",
diff --git a/apps/web/playwright.config.ts b/apps/web/playwright.config.ts
new file mode 100644
index 0000000..2faad97
--- /dev/null
+++ b/apps/web/playwright.config.ts
@@ -0,0 +1,57 @@
+// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import { defineConfig } from "@playwright/test";
+import { layoutHosts } from "./e2e/pages";
+
+/**
+ * Layout tests of the built site in Chromium, at the widths of phones, a
+ * tablet and a desktop.
+ *
+ * The site picks its pages by host name, so every public host name resolves
+ * to the local server: the browser asks for http://viget.progmasoft.com/ and
+ * the request reaches `next start` on 127.0.0.1 with that Host header. No
+ * request leaves the machine.
+ */
+const port = 3100;
+const hostRules = layoutHosts
+  .map((host) => `MAP ${host} 127.0.0.1:${port}`)
+  .join(", ");
+
+const phone = { isMobile: true, hasTouch: true, deviceScaleFactor: 2 };
+
+export default defineConfig({
+  testDir: "e2e",
+  fullyParallel: true,
+  forbidOnly: Boolean(process.env.CI),
+  reporter: process.env.CI
+    ? [["list"], ["html", { open: "never", outputFolder: "playwright-report" }]]
+    : "list",
+  use: {
+    browserName: "chromium",
+    launchOptions: { args: [`--host-resolver-rules=${hostRules}`] },
+    screenshot: "only-on-failure",
+    trace: "retain-on-failure",
+  },
+  projects: [
+    {
+      name: "phone-360",
+      use: { ...phone, viewport: { width: 360, height: 780 } },
+    },
+    {
+      name: "phone-390",
+      use: { ...phone, viewport: { width: 390, height: 844 } },
+    },
+    {
+      name: "tablet-768",
+      use: { ...phone, viewport: { width: 768, height: 1024 } },
+    },
+    { name: "desktop-1280", use: { viewport: { width: 1280, height: 800 } } },
+  ],
+  webServer: {
+    command: `pnpm exec next start --hostname 127.0.0.1 --port ${port}`,
+    url: `http://127.0.0.1:${port}/robots.txt`,
+    reuseExistingServer: !process.env.CI,
+    timeout: 120_000,
+  },
+});
diff --git a/package.json b/package.json
index 8333c9e..3d32c09 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
     "check": "pnpm --filter @progmasoft/web check",
     "test": "pnpm --filter @progmasoft/web test",
     "test:coverage": "pnpm --filter @progmasoft/web test:coverage",
+    "test:layout": "pnpm --filter @progmasoft/web test:layout",
     "lint": "pnpm --filter @progmasoft/web lint",
     "format": "pnpm --filter @progmasoft/web format"
   }
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index da42916..3b130af 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -18,7 +18,7 @@ importers:
     dependencies:
       next:
         specifier: 16.4.5
-        version: 16.4.5(@babel/core@7.29.7(supports-color@7.2.0))(@types/node@24.19.2)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
+        version: 16.4.5(@babel/core@7.29.7(supports-color@7.2.0))(@playwright/test@1.65.0)(@types/node@24.19.2)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
       react:
         specifier: 19.3.1
         version: 19.3.1
@@ -26,6 +26,9 @@ importers:
         specifier: 19.3.1
         version: 19.3.1(react@19.3.1)
     devDependencies:
+      '@playwright/test':
+        specifier: 1.65.0
+        version: 1.65.0
       '@types/node':
         specifier: 24.19.2
         version: 24.19.2
@@ -466,6 +469,11 @@ packages:
     resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==}
     engines: {node: '>=12.4.0'}
 
+  '@playwright/test@1.65.0':
+    resolution: {integrity: sha512-iGURLGuKDLakSEl7Pgfv8h7f+XLT+V861Wfhz0zlEl5nyFuKUopdkFBPKqTllTUp06aOwPuH8iuUEb3yp3MpbQ==}
+    engines: {node: '>=20'}
+    hasBin: true
+
   '@rtsao/scc@1.1.0':
     resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==}
 
@@ -1602,6 +1610,16 @@ packages:
     resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}
     engines: {node: '>=12'}
 
+  playwright-core@1.65.0:
+    resolution: {integrity: sha512-vNSKgH6YqtN7cdT/L334zo0a+YwkrpicyrHJlWWPIm/Q+Nn2SWInil01oT0mbu96U4GgoRtCYQD9CzJQgju+lA==}
+    engines: {node: '>=20'}
+    hasBin: true
+
+  playwright@1.65.0:
+    resolution: {integrity: sha512-F3AMWcR44qMBt4kq+6Kb6mX7bjGXshktKFOPULd7reED6ZJWevjbNRqysP7q+AATE9kdPEZBibex1BYsvpVoeA==}
+    engines: {node: '>=20'}
+    hasBin: true
+
   possible-typed-array-names@1.1.0:
     resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==}
     engines: {node: '>= 0.4'}
@@ -2332,6 +2350,10 @@ snapshots:
 
   '@nolyfill/is-core-module@1.0.39': {}
 
+  '@playwright/test@1.65.0':
+    dependencies:
+      playwright: 1.65.0
+
   '@rtsao/scc@1.1.0': {}
 
   '@swc/helpers@0.5.23':
@@ -3513,7 +3535,7 @@ snapshots:
 
   natural-compare@1.4.0: {}
 
-  next@16.4.5(@babel/core@7.29.7(supports-color@7.2.0))(@types/node@24.19.2)(react-dom@19.3.1(react@19.3.1))(react@19.3.1):
+  next@16.4.5(@babel/core@7.29.7(supports-color@7.2.0))(@playwright/test@1.65.0)(@types/node@24.19.2)(react-dom@19.3.1(react@19.3.1))(react@19.3.1):
     dependencies:
       '@next/env': 16.4.5
       '@swc/helpers': 0.5.23
@@ -3532,6 +3554,7 @@ snapshots:
       '@next/swc-linux-x64-musl': 16.4.5
       '@next/swc-win32-arm64-msvc': 16.4.5
       '@next/swc-win32-x64-msvc': 16.4.5
+      '@playwright/test': 1.65.0
       sharp: 0.35.5(@types/node@24.19.2)
     transitivePeerDependencies:
       - '@babel/core'
@@ -3634,6 +3657,12 @@ snapshots:
 
   picomatch@4.0.7: {}
 
+  playwright-core@1.65.0: {}
+
+  playwright@1.65.0:
+    dependencies:
+      playwright-core: 1.65.0
+
   possible-typed-array-names@1.1.0: {}
 
   postcss@8.5.23: