From 61e8555199b8dc634ea6196cab2dbaf0a9c49b81 Mon Sep 17 00:00:00 2001 From: "Claude (KI)" Date: Tue, 6 Oct 2026 12:19:20 +0200 Subject: [PATCH] Formularhinweise per aria-describedby an das Eingabefeld binden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Field hängte den Hinweistext nur optisch an; Screenreader lasen ihn beim Fokus nicht vor. Jetzt bekommt das Eingabeelement aria-describedby auf den Hinweis (WCAG 1.3.1/3.3.2). Doku-Breakpoint auf 800 px korrigiert. E2E (axe, Desktop/360 px) weiterhin 8/8 grün. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/ui.tsx | 7 +++++-- docs/design/README.md | 2 +- docs/design/sitemap.md | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/ui.tsx b/apps/web/src/components/ui.tsx index f5abd61..1d22e48 100644 --- a/apps/web/src/components/ui.tsx +++ b/apps/web/src/components/ui.tsx @@ -1,4 +1,4 @@ -import type { ReactNode } from 'react'; +import { cloneElement, isValidElement, type ReactElement, type ReactNode } from 'react'; /** Einheitliches Statussystem: Text + Symbol, nie nur Farbe. */ const MAP: Record = { @@ -11,8 +11,11 @@ export function Status({ value }: { value: string }) { return {m.label}; } export const Alert = ({ kind, children }: { kind: 'err' | 'ok' | 'warn' | 'info'; children: ReactNode }) =>
{children}
; +/** Formularfeld: sichtbares, verknüpftes Label; ein Hinweis wird per aria-describedby an das Eingabeelement gebunden. */ export const Field = ({ id, label, children, hint }: { id: string; label: string; children: ReactNode; hint?: string }) => ( -
{children}{hint && {hint}}
+
+ {hint && isValidElement(children) ? cloneElement(children as ReactElement<{ 'aria-describedby'?: string }>, { 'aria-describedby': `${id}-hint` }) : children} + {hint && {hint}}
); export const Empty = ({ title, children }: { title: string; children?: ReactNode }) =>

{title}

{children}
; export const fmt = (d: string | Date) => new Date(d).toLocaleString('de-DE', { dateStyle: 'medium', timeStyle: 'short' }); diff --git a/docs/design/README.md b/docs/design/README.md index 94fc272..ce00cb6 100644 --- a/docs/design/README.md +++ b/docs/design/README.md @@ -28,7 +28,7 @@ Hell/Dunkel folgt `prefers-color-scheme`; die manuelle Wahl (ThemeToggle) setzt - `Field id label hint` – Label immer sichtbar und verknüpft, Hinweis per `aria-describedby`. - `Empty title` – Leerzustand mit Erklärung, was zu tun ist. - Status-Badges (`Status`, `ResState`, `JobStatus`, `OrderStatusBadge`, `ContractStatusBadge`, `InvoiceStatusBadge`, `TicketStatusBadge`) – Symbol (`aria-hidden`) + Klartext. -- `TableCards` – Tabellen werden unter 720 px automatisch zu Karten (Spaltenkopf als Label). +- `TableCards` – Tabellen werden auf schmalen Bildschirmen (≤ 800 px) automatisch zu Karten (Spaltenkopf als Label). - `SecretField` – Geheimnisse nur auf ausdrücklichen Abruf, Kopieren ohne Anzeige. - Formatierer: `fmt` (Datum+Zeit), `fmtDate`, `fmtDay` (Kalendertag in UTC), `eur` (Cent → Euro). diff --git a/docs/design/sitemap.md b/docs/design/sitemap.md index 3e07998..28c545a 100644 --- a/docs/design/sitemap.md +++ b/docs/design/sitemap.md @@ -30,7 +30,7 @@ Stand: 06.10.2026, aus `apps/web/src/app` (alle `page.tsx`). Sichtbarkeit richte | Verwaltung | `/admin/benutzer`, `/admin/auftraege`, `/admin/audit` | | Einstellungen | `/einstellungen` → `firma`, `lizenz`, `email` (SMTP/IMAP/Vorlagen), `discord`, `backup`, `verbindungen` | -Mobil (< 720 px): untere Navigation Übersicht · Ressourcen · Tickets · Rechnungen · Mehr (öffnet die volle Navigation inkl. Konto/Abmelden). +Mobil (≤ 800 px): untere Navigation Übersicht · Ressourcen · Tickets · Rechnungen · Mehr (öffnet die volle Navigation inkl. Konto/Abmelden). ## Kernabläufe 1. **Kunde anlegen → Einladung → erste Anmeldung:** Personal `/admin/kunden` → „Kunde anlegen“ → Mail/Link → `/einladung` → `/login` → `/dashboard`. (E2E: `apps/e2e`)