Formularhinweise per aria-describedby an das Eingabefeld binden
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 <noreply@anthropic.com>
This commit is contained in:
parent
dc54295f9d
commit
61e8555199
3 changed files with 7 additions and 4 deletions
|
|
@ -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<string, { cls: string; icon: string; label: string }> = {
|
||||
|
|
@ -11,8 +11,11 @@ export function Status({ value }: { value: string }) {
|
|||
return <span className={`badge ${m.cls}`}><span aria-hidden="true">{m.icon}</span>{m.label}</span>;
|
||||
}
|
||||
export const Alert = ({ kind, children }: { kind: 'err' | 'ok' | 'warn' | 'info'; children: ReactNode }) => <div className={`alert ${kind}`} role={kind === 'err' ? 'alert' : 'status'}>{children}</div>;
|
||||
/** 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 }) => (
|
||||
<div className="field"><label htmlFor={id}>{label}</label>{children}{hint && <span className="muted small">{hint}</span>}</div>
|
||||
<div className="field"><label htmlFor={id}>{label}</label>
|
||||
{hint && isValidElement(children) ? cloneElement(children as ReactElement<{ 'aria-describedby'?: string }>, { 'aria-describedby': `${id}-hint` }) : children}
|
||||
{hint && <span id={`${id}-hint`} className="muted small">{hint}</span>}</div>
|
||||
);
|
||||
export const Empty = ({ title, children }: { title: string; children?: ReactNode }) => <div className="empty"><h3>{title}</h3>{children}</div>;
|
||||
export const fmt = (d: string | Date) => new Date(d).toLocaleString('de-DE', { dateStyle: 'medium', timeStyle: 'short' });
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
||||
|
|
|
|||
|
|
@ -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`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue