dorfteich/apps/web/src/lib/single-key-shortcuts.ts
Claude Fable 5 31b59f0fb6 #170: Statusmeldungen, Einzeltasten-Shortcuts, Bewegung
Toast-Standzeit 2,5s auf 6s (WCAG 2.2.1 — für Screenreader-/Zoom-Nutzer
kaum erfassbar). Neue Einstellungs-Sektion Bedienung mit dem Schalter
Einzeltasten-Kürzel deaktivieren (lokale Geräte-Einstellung); die
Handler von e und / prüfen sie beim Tastendruck (WCAG 2.1.4).
prefers-reduced-motion: CSS-Transitions kollabieren auf instant, die
Graph-Simulation rechnet ihr Layout synchron zu Ende statt zu animieren
(WCAG 2.2.2). settings-nav-Spec auf 8 Sektionen nachgeführt. Bewusst
KEIN zusätzliches role=status (legal.spec-Locator-Falle).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AGM8jo3hwoV9wsCVGfy8iq
2026-07-21 14:39:03 +02:00

14 lines
534 B
TypeScript

/** localStorage key for the "disable single-key shortcuts" preference
* (issue #170, WCAG 2.1.4): `e` (edit mode) and `/` (search) can misfire
* for speech-input users, so they must be switch-offable. */
export const SINGLE_KEY_SHORTCUTS_KEY = 'ui.singleKeyShortcuts.disabled';
/** Read at keypress time so the toggle needs no cross-component state. */
export function singleKeyShortcutsDisabled(): boolean {
try {
return window.localStorage.getItem(SINGLE_KEY_SHORTCUTS_KEY) === 'true';
} catch {
return false;
}
}