From 942f7b13d3ae81dcd8366fff7d0a804a119c6f86 Mon Sep 17 00:00:00 2001 From: Claude Opus 5 Date: Sat, 1 Aug 2026 19:05:18 +0200 Subject: [PATCH] #304: scope the legal spec's status locator to its own form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The font manager's upload live regions made `getByRole('status')` ambiguous on /admin, and legal.spec.ts — which asserts the legal form's success message — started failing in the e2e pack. That is the documented trap in CLAUDE.md: a new label or region makes an existing page-wide locator ambiguous, and the fix is to scope the SPEC, not to drop the region a screen reader needs. The section gets a named class for exactly that purpose. Verified locally against the running stack: legal, fonts, admin-users, admin-quotas and the a11y pack all pass. --- apps/web/e2e/legal.spec.ts | 6 +++++- apps/web/src/pages/AdminSettingsPage.tsx | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/web/e2e/legal.spec.ts b/apps/web/e2e/legal.spec.ts index c12eae7..519bc81 100644 --- a/apps/web/e2e/legal.spec.ts +++ b/apps/web/e2e/legal.spec.ts @@ -63,7 +63,11 @@ test('the admin form previews and publishes the privacy policy', async ({ browse await expect(editor.locator('.legal-editor__preview strong')).toHaveText('only what is needed'); await page.getByRole('button', { name: /save legal pages|rechtsseiten speichern/i }).click(); - await expect(page.getByRole('status')).toBeVisible(); + // Auf den Abschnitt gescopet: seit der Schriftverwaltung (#304) hat /admin + // weitere Live-Regionen (Upload-Fortschritt), und ein seitenweites + // getByRole('status') wäre mehrdeutig. Gemeint war immer die + // Erfolgsmeldung DIESES Formulars. + await expect(page.locator('.legal-settings').getByRole('status')).toBeVisible(); await admin.close(); const anonymous = await browser.newContext({ baseURL: BASE_URL }); diff --git a/apps/web/src/pages/AdminSettingsPage.tsx b/apps/web/src/pages/AdminSettingsPage.tsx index df30922..206992f 100644 --- a/apps/web/src/pages/AdminSettingsPage.tsx +++ b/apps/web/src/pages/AdminSettingsPage.tsx @@ -459,7 +459,10 @@ function LegalSettingsForm({ settings }: { settings: InstanceSettings }): React. } return ( -
+ // Named class so the e2e can scope its success-message assertion to this + // form: /admin has more than one live region since #304 (upload progress), + // and a page-wide getByRole('status') became ambiguous. +

{t('admin.title')}

{t('admin.hint')}

void onSubmit(event)} noValidate>