[250] Overlay-Dialoge: Fokus, Tab-Falle und Fokus-Rückkehr über useModalFocus, Namen für unbeschriftete Felder
This commit is contained in:
20 files changed
+169
-23
No files matched your search
@@ -10,7 +10,7 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
|
||||
stehen im Archiv („Bewusst nicht übernommen“).
|
||||
- **Grösse** (eine Person mit Agenten): S ≤ 1 Tag · M ≤ 1 Woche · L ≤ 1 Monat · XL > 1 Monat.
|
||||
Steht keine Grösse im Archiv, ist sie hier geschätzt.
|
||||
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 249);
|
||||
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 250);
|
||||
nie eine ID wiederverwenden oder umnummerieren. Präfix-IDs (`[K]`, `[G]`, `[T]`, `[B]`, `[C]`) bleiben.
|
||||
- **Pro Punkt:** was fehlt · wo im Code · Grösse. Höchstens ein bis drei Sätze je Punkt;
|
||||
Messwerte und Befunde gehören in den Commit.
|
||||
@@ -1269,6 +1269,7 @@ exakte Durchdringung, [61] Zuordnung per Hand, [63] Profil je Kante, [70] Fläch
|
||||
- [246] Kamerafahrt (13.11., Folge aus [213]; nur TS, Chromium; Mac/Tauri nicht geprüft): Knopf „▶ Kamerafahrt“ in der Kamera-Gruppe (Panel „Ausschnitte“) fährt im 3D-Viewport in Listenreihenfolge durch die Kameras (Catmull-Rom „flüssig“ oder „geglättet“ mit Smoothstep, Bildwinkel linear, Dauer je Abschnitt Vorgabe 4 s; Esc oder Klick bricht ab; Kameras bleiben unverändert, kein Op); „Video …“ öffnet den Dialog mit Dauer, Interpolation, Format (WebM, MP4 nur wenn `MediaRecorder` es kann), Auflösung = Viewport, 30 Bilder/s, Fortschritt und Abbruch, Speichern über `saveBinaryFile`. Code: `viewport/cameraTour.ts` (Interpolation), `cameraTourPlayer.ts`, `videoRecorder.ts`, `state/cameraTourActions.ts`, `ui/CameraTourDialog.tsx` + `cameraTourDialogState.ts`; Tests vitest je Modul, e2e `cameraTour.spec.ts`. Offen: Aufnahme unter Tauri/WKWebView (fehlt `MediaRecorder` auf dem Canvas, meldet der Dialog per `notify`), Bildinhalt der Aufnahme nicht gesehen (headless WebGPU leer), im Stil Pathtracing nur Vorschau-Qualität.
|
||||
- [248] Kurzanleitung: Begehen mit Kollision ([245]: Wände/Glas sperren, Türen frei, Treppen, G = Geist), Kamerafahrt ([246]: Knöpfe, Dauer, Fahrt, Video WebM/MP4, Esc) und gegliedertes Darstellungsarten-Menü mit Pathtracing unter „Rendern“ ([244]) beschrieben (13.11.); `kurzanleitung.test.ts` bleibt grün (keine neue Angabenart). Nicht in der App geprüft.
|
||||
- [249] Tastatur und Fokus in den neuen Dialogen und Leisten (13.11.; nur TS/CSS). Neue gemeinsame Hülle `ui/modalFocus.ts` (`useModalFocus`: erstes Feld fokussiert, Tab-Falle auch bei Fokus auf dem Dokument, Esc, Enter im Eingabefeld = Hauptaktion, Fokus zurück zum Auslöser, Fokus kehrt in den Dialog zurück, wenn ihn die Befehlszeile sich nach dem öffnenden Befehl holt) für Kürzel-Übersicht, Kamerafahrt, 3D-Bild und Rendering (die übrigen Overlay-Dialoge hatten bisher keine Falle). Hintergrund-Kürzel: `isEditableTarget` (`useKeyboardShortcuts`), Zifferntasten, Begehen (`walkKeyAllowed`) und die Blatt-Tasten (`LayoutSheet`) ignorieren Ziele in `aria-modal`-Dialogen (`state/modalScope.ts`); vorher sprang Tab auf einem Dialogknopf in die Befehlszeile dahinter. 3D-Leiste: stabiler Name + `aria-pressed` statt wechselndem `aria-label`, Tab bleibt in der Leiste (Ausnahme vom Tab = Befehlszeile). Dropdown: Gruppen als benannte `role="group"`, `aria-activedescendant`/`aria-controls`, Home/End, Tab schliesst, Fokus zurück zum Trigger (auch nach Mausauswahl). Hilfslinien-Panel und Bild-HUD: `role="group"`, beschriftete Felder, Fokus ins Positionsfeld, Esc schliesst (Fokus zurück zum Knopf), Esc im Zuschnitt-Feld beendet den Zuschnitt, Enter übernimmt Zeilenwerte, Liste scrollt bei vielen Linien. Rendering/3D-Bild: Auswahlfelder beschriftet, Fokus auf „Abbrechen" während der Arbeit. Objekt-Info-Gruppen: `aria-controls`. Fokusring-Token `--focus-ring` (hell/dunkel) für Dialoge, Blatt-HUDs, Gruppenköpfe, Dropdown-Trigger. Geprüft: tsc, vitest `src/ui src/viewport src/panels src/i18n src/state`, e2e `a11yNewDialogs` (9) plus cameraTour, walk, competition, release10, commandKeys, objectSettings, roomStamp218, layoutSheet, viewTemplates, overridesTab, presentationSheet (Chromium, Linux). Offen: Tab ausserhalb von Feldern, Dialogen und der 3D-Leiste springt weiter in die Befehlszeile (Entscheid Maintainer: Dock-Knöpfe per Tab erreichbar machen?); die 3D-Leiste steht im Tab-Lauf hinter Dock-Reitern; übrige ältere Overlay-Dialoge ohne Falle/Fokus-Rückkehr; nicht auf dem Mac/in der Tauri-App, nicht mit VoiceOver geprüft.
|
||||
- [250] Ältere Overlay-Dialoge auf die Hülle aus [249] (13.11.; nur TS). `useModalFocus` jetzt auch in Export (IFC/OBJ/…, DXF/DWG, PDF), Import (Zeichnung/PDF, IFC + Bericht, Mesh, Punktwolke, Kontext, Raumprogramm), Einstellungen, Standards-Update, Neues Layout/Masterlayout, Präsentationsplan, Eingabe-Dialog, Über, Ungespeicherte Änderungen, Autosave-Wiederherstellung, Sperr-Konflikt: Fokus beim Öffnen im Dialog (bei Rückfragen auf „Abbrechen"/„Später", nie auf Verwerfen/Überschreiben), Tab-Falle, Fokus zurück zum Auslöser, Hintergrund-Kürzel gesperrt. Esc und Enter blieben wie bisher in den Dialogen selbst (keine zweite Enter-Aktion, keine bei Löschen/Überschreiben). `autoFocus` in Export-/Eingabe-Dialog durch `data-autofocus` ersetzt (autoFocus lief vor der Hülle und machte das Feld zum „Auslöser"). Namen für Felder ohne Label: Layout-Format/Plakat/Master, Präsentationsplan (Schnitt, Blatt, Massstab, Papier, Massstab je Ansicht), Dateiname, Massstab-Freitext, Kürzel-Auswahl, Eingabefeld = Frage. Geprüft: tsc, vitest `src/ui src/panels src/state src/i18n`, e2e `a11yNewDialogs` (13, 4 neue) plus aiBridge, commandKeys, competition, io, levelZero, presentationSheet, release10, roomprogram, layoutSheet, kataster (Chromium, Linux). Offen: Enter-Hauptaktion nur dort, wo schon vorhanden (Eingabe-, Export-Dateiname-, Layout- und Präsentations-Dialog); im Layout-Dialog löst Enter auch auf „Abbrechen" die Erstellung aus (bestehendes Verhalten, `window`-Listener); Dialoge ohne eigene Prüfung im e2e: Mesh/Punktwolke/Kontext/Raumprogramm/IFC-Import, Standards-Update, Sperr-Konflikt, Autosave, Über, Eingabe-Dialog (gleiche Hülle, nur per tsc/Aufrufer-Specs abgedeckt); nicht auf dem Mac/in der Tauri-App, nicht mit VoiceOver geprüft.
|
||||
- [247] Kurzanleitung passt zur App (13.11.): Bedienangaben in `doc/KURZANLEITUNG.md` gegen de.ts, Menüs (`appMenu.ts`, `AppMenuBar`), Befehls-Registry und Kürzel belegt; Test `src/i18n/kurzanleitung.test.ts` prüft Menüpfade, fette/„quotierte“ Bedienelemente, Befehle in Backticks und ⌘-Kürzel. Korrigiert: Browser-Menü (kürzer, anders benannt), „Vorsprünge bis“, Dachform „Flachdach“ als Auswahlfeld im Panel Objekt-Info (+ Wahl in der Befehlszeile `rf`), Geschoss kopieren per ⌘C/⌘6/⌘V (⌘D dupliziert nur mit Versatz auf demselben Geschoss), „Objekt-Info“, Ressourcen als Fenster. Ergänzt: Begehen (Umschalt+F) und Kameras. Offen: Begehen mit Kollision/Geist (G), Kamerafahrt/Video und Gruppen im Darstellungs-Menü stehen in diesem Stand nicht im Code und fehlen in der Anleitung. Geprüft: tsc, vitest `src/i18n`; nicht in der App angesehen.
|
||||
- [243] Qualität der neuen UI-Texte seit 12.11. (13.11.): Durchsicht aller neuen de/en-Schlüssel ([209] Kosten, [211] Blender, 3D-Bild, Hilfslinien, Körper→Bauteile, Raumstempel …). en: „building parts“ → „components“ (wie übriges en.ts), Kosten-Texte (Subtotal, Key figure, excluding land, attic storeys …), 3D-Bild-Fehler (graphics card returned no image, eye point and target coincide), „Automatic/Common scale“, „To change:“ u. a.; de: „Alt schaltet den Fang aus“, „Standpunkt und Ziel fallen zusammen“, „nicht als Bildschirmfoto“, „Ansichtsvorlage „Präsentation““, „MwSt. (Z)“. Platzhalter de/en geprüft (alle gleich), Schlüssel unverändert. Offen: `vitest src/i18n` und volles tsc im Worktree mangels WASM-Paketen nicht gelaufen
|
||||
- [240] 3D-Viewport: Knöpfe und Anzeigen schöner (13.11., Wunsch Maintainer). Neue Komponente `src/viewport/ViewportToolbar3d.tsx` (eigener CSS-Block `.vp3t-*`;
|
||||
|
||||
@@ -391,3 +391,98 @@ test("Objekt-Info: Gruppenköpfe per Tastatur auf- und zuklappen, aria-controls,
|
||||
await shot(page, "objinfo-gruppe-dunkel");
|
||||
await setTheme(page, "light");
|
||||
});
|
||||
|
||||
// [250] Ältere Overlay-Dialoge auf dieselbe Hülle (`useModalFocus`): Fokus beim Öffnen im Dialog, Tab-Falle, Esc
|
||||
// (wie bisher über den Dialog selbst), Fokus zurück zum Auslöser, Hintergrund-Kürzel gesperrt.
|
||||
|
||||
test("Export-Dialoge (IFC, DXF): Fokus im Dialog, Dateiname fokussiert, Tab-Falle, Esc, Fokus zurück zum Datei-Menü", async ({ page }) => {
|
||||
test.setTimeout(150_000);
|
||||
await startWithHooks(page);
|
||||
await openSample(page);
|
||||
await selectAllWalls(page);
|
||||
const fileBtn = page.getByRole("button", { name: "Datei", exact: true });
|
||||
await fileMenu(page, "Exportieren: IFC");
|
||||
const ifc = page.getByRole("dialog", { name: "Exportieren" });
|
||||
await expect(ifc).toBeVisible();
|
||||
await expect(ifc.getByRole("textbox", { name: "Dateiname" })).toBeFocused();
|
||||
await expectTrapped(page, ifc);
|
||||
await expectNoBackgroundShortcuts(page, ifc);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(ifc).toHaveCount(0);
|
||||
await expect(fileBtn).toBeFocused();
|
||||
await fileMenu(page, "Exportieren: DXF");
|
||||
const dxf = page.getByRole("dialog", { name: "DXF/DWG exportieren" });
|
||||
await expect(dxf).toBeVisible();
|
||||
expect(await focusInside(dxf)).toBe(true);
|
||||
await expectTrapped(page, dxf);
|
||||
await expectNoBackgroundShortcuts(page, dxf);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(dxf).toHaveCount(0);
|
||||
await expect(fileBtn).toBeFocused();
|
||||
});
|
||||
|
||||
test("Ungespeicherte Änderungen: Fokus auf Abbrechen (nie auf Verwerfen), Enter bricht ab, Tab-Falle, Esc", async ({ page }) => {
|
||||
test.setTimeout(150_000);
|
||||
await startWithHooks(page);
|
||||
await openSample(page);
|
||||
// Eine Änderung (Wände löschen), damit die Rückfrage kommt.
|
||||
await selectAllWalls(page);
|
||||
await page.keyboard.press("Delete");
|
||||
const fileBtn = page.getByRole("button", { name: "Datei", exact: true });
|
||||
await fileMenu(page, /^Neu aus Vorlage: Musterhaus$/);
|
||||
const dlg = page.getByRole("dialog", { name: "Ungespeicherte Änderungen" });
|
||||
await expect(dlg).toBeVisible();
|
||||
await expect(dlg.getByRole("button", { name: "Abbrechen" })).toBeFocused();
|
||||
await expectTrapped(page, dlg);
|
||||
await dlg.getByRole("button", { name: "Abbrechen" }).focus();
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(dlg).toHaveCount(0);
|
||||
await expect(page.locator(".project-name")).toHaveText("Demo-Haus");
|
||||
await fileMenu(page, /^Neu aus Vorlage: Musterhaus$/);
|
||||
await expect(dlg).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(dlg).toHaveCount(0);
|
||||
await expect(fileBtn).toBeFocused();
|
||||
});
|
||||
|
||||
test("Einstellungen: Fokus im Dialog, Tab-Falle, Esc, Fokus zurück", async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
await startWithHooks(page);
|
||||
const menu = page.getByRole("menubar").getByRole("button", { name: "Fenster", exact: true });
|
||||
await menu.click();
|
||||
await page.getByRole("option", { name: "Einstellungen" }).click();
|
||||
const dlg = page.getByRole("dialog", { name: "Einstellungen" });
|
||||
await expect(dlg).toBeVisible();
|
||||
expect(await focusInside(dlg)).toBe(true);
|
||||
await expectTrapped(page, dlg);
|
||||
await expectNoBackgroundShortcuts(page, dlg);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(dlg).toHaveCount(0);
|
||||
await expect(menu).toBeFocused();
|
||||
});
|
||||
|
||||
test("Neues Layout und Präsentationsplan: Fokus im Dialog, beschriftete Auswahlfelder, Tab-Falle, Esc", async ({ page }) => {
|
||||
test.setTimeout(150_000);
|
||||
await startWithHooks(page);
|
||||
await openSample(page);
|
||||
await openTab(page, "Mappe");
|
||||
const opener = page.getByRole("button", { name: "Layout erstellen" }).first();
|
||||
await opener.click();
|
||||
const dlg = page.getByRole("dialog", { name: "Neues Layout" });
|
||||
await expect(dlg).toBeVisible();
|
||||
expect(await focusInside(dlg)).toBe(true);
|
||||
await dlg.getByTestId("newlayout-poster").check();
|
||||
await expect(dlg.getByTestId("newlayout-poster-select")).toHaveAccessibleName(/\S/);
|
||||
await expectTrapped(page, dlg);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(dlg).toHaveCount(0);
|
||||
await typeCommand(page, "praesentation");
|
||||
const pres = page.getByRole("dialog", { name: "Präsentationsplan" });
|
||||
await expect(pres).toBeVisible();
|
||||
expect(await focusInside(pres)).toBe(true);
|
||||
await expect(pres.getByTestId("presentation-paper")).toHaveAccessibleName("Papierformat");
|
||||
await expect(pres.getByTestId("presentation-scale")).toHaveAccessibleName("Massstab");
|
||||
await expectTrapped(page, pres);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(pres).toHaveCount(0);
|
||||
});
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import { geocode, fetchBuildings } from "../io/swissTopo";
|
||||
import type { GeocodeCandidate } from "../io/swissTopo";
|
||||
import { fetchBuildings3d } from "../io/swissBuildings3d";
|
||||
@@ -102,6 +103,7 @@ export function ContextImportDialog({
|
||||
onSetGeoAnchor,
|
||||
windowed = false,
|
||||
}: ContextImportDialogProps) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -357,7 +359,7 @@ export function ContextImportDialog({
|
||||
const dialog = (
|
||||
<div
|
||||
className={`imp-dialog${windowed ? " imp-dialog-embedded" : ""}`}
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("ctxImport.title")}
|
||||
onClick={windowed ? undefined : (e) => e.stopPropagation()}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import { Dropdown } from "./Dropdown";
|
||||
import type { CadExportFormat } from "../export/exportDxf";
|
||||
import { SCALE_PRESETS } from "./TopBar";
|
||||
@@ -48,6 +49,7 @@ export function ExportDxfDialog({
|
||||
onExport,
|
||||
onClose,
|
||||
}: ExportDxfDialogProps) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -82,7 +84,7 @@ export function ExportDxfDialog({
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("exportDxf.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import { Dropdown } from "./Dropdown";
|
||||
import { SCALE_PRESETS, parseScaleInput } from "./TopBar";
|
||||
import type { Orientation, PaperFormat } from "../export/exportPdf";
|
||||
@@ -57,6 +58,7 @@ export function ExportPdfDialog({
|
||||
onExportSvg,
|
||||
onClose,
|
||||
}: ExportPdfDialogProps) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -115,7 +117,7 @@ export function ExportPdfDialog({
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("export.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
@@ -152,6 +154,7 @@ export function ExportPdfDialog({
|
||||
<input
|
||||
className="imp-input"
|
||||
type="text"
|
||||
aria-label={t("export.scale")}
|
||||
placeholder={t("export.scale.customPlaceholder")}
|
||||
value={customScaleText}
|
||||
onChange={(e) => setCustomScaleText(e.target.value)}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import { Dropdown } from "./Dropdown";
|
||||
import type { IfcExportOptions, IfcSchema } from "../export/exportIfc";
|
||||
|
||||
@@ -48,6 +49,7 @@ export function ExportSaveDialog({
|
||||
onSave,
|
||||
onClose,
|
||||
}: ExportSaveDialogProps) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -72,7 +74,7 @@ export function ExportSaveDialog({
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("exportSave.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
@@ -134,8 +136,9 @@ export function ExportSaveDialog({
|
||||
<input
|
||||
className="settings-num-input"
|
||||
type="text"
|
||||
aria-label={t("exportSave.filename")}
|
||||
value={name}
|
||||
autoFocus
|
||||
data-autofocus
|
||||
spellCheck={false}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import type { IfcElementsSummary } from "../io/ifcImport";
|
||||
|
||||
export type IfcImportMode = "mesh" | "elements";
|
||||
@@ -16,6 +17,7 @@ export interface IfcImportDialogProps {
|
||||
export function IfcImportDialog({ fileName, onImport, onCancel }: IfcImportDialogProps) {
|
||||
const [mode, setMode] = useState<IfcImportMode>("mesh");
|
||||
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onCancel();
|
||||
@@ -28,7 +30,7 @@ export function IfcImportDialog({ fileName, onImport, onCancel }: IfcImportDialo
|
||||
<div className="imp-overlay" onClick={onCancel}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("ifc.importDialog.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
@@ -97,6 +99,7 @@ export function IfcImportReportDialog({
|
||||
summary: IfcElementsSummary;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape" || e.key === "Enter") onClose();
|
||||
@@ -111,7 +114,7 @@ export function IfcImportReportDialog({
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("ifc.importReport.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import type { DrawingLevelKind, Project } from "../model/types";
|
||||
import type { ImportDiagnostics, ParsedImport } from "../io/importSource";
|
||||
@@ -156,6 +157,7 @@ export function ImportDialog({
|
||||
onClose,
|
||||
}: ImportDialogProps) {
|
||||
// Esc schließt den Dialog (wie ResourceManager).
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -232,7 +234,7 @@ export function ImportDialog({
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={pdf ? t("import.pdf.title") : t("import.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import type {
|
||||
LayoutOrientation,
|
||||
LayoutPaperFormat,
|
||||
@@ -79,6 +80,7 @@ function SizePicker({
|
||||
<div className="imp-section-title">{t("layouts.size.format")}</div>
|
||||
<select
|
||||
className="imp-select"
|
||||
aria-label={t("layouts.size.format")}
|
||||
value={mode}
|
||||
onChange={(e) => setMode(e.target.value as SizeMode)}
|
||||
>
|
||||
@@ -157,6 +159,7 @@ function DialogFrame({
|
||||
onConfirm: () => void;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -170,7 +173,7 @@ function DialogFrame({
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={title}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
@@ -298,7 +301,7 @@ export function NewLayoutDialog({
|
||||
|
||||
{source === "poster" ? (
|
||||
<section className="imp-section">
|
||||
<select className="imp-select" data-testid="newlayout-poster-select" value={posterKey} onChange={(e) => setPosterKey(e.target.value)}>
|
||||
<select className="imp-select" data-testid="newlayout-poster-select" aria-label={t("layouts.newLayout.poster")} value={posterKey} onChange={(e) => setPosterKey(e.target.value)}>
|
||||
{POSTER_TEMPLATES.map((p) => (
|
||||
<option key={p.key} value={p.key}>
|
||||
{posterTemplateLabel(p)}
|
||||
@@ -312,6 +315,7 @@ export function NewLayoutDialog({
|
||||
{hasMasters ? (
|
||||
<select
|
||||
className="imp-select"
|
||||
aria-label={t("layouts.master")}
|
||||
value={masterId}
|
||||
onChange={(e) => setMasterId(e.target.value)}
|
||||
>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import type { LockInfo } from "../native/projectFile";
|
||||
|
||||
export interface LockConflictDialogProps {
|
||||
@@ -23,6 +24,7 @@ export function LockConflictDialog({
|
||||
onForceOpen,
|
||||
onCancel,
|
||||
}: LockConflictDialogProps) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onCancel();
|
||||
@@ -35,7 +37,7 @@ export function LockConflictDialog({
|
||||
<div className="imp-overlay" onClick={onCancel}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("lock.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import { useEffect, useRef, useState, memo } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import { Dropdown } from "./Dropdown";
|
||||
import {
|
||||
MESH_EXTENSIONS,
|
||||
@@ -53,6 +54,7 @@ function MeshImportDialog({ req, onImport, notify }: { req: MeshImportRequest }
|
||||
// Dateiinhalt einmal laden, nicht bei jeder Änderung.
|
||||
const cache = useRef<{ main: Uint8Array; files: { name: string; bytes: Uint8Array }[] } | null>(null);
|
||||
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") closeMeshImport();
|
||||
@@ -107,7 +109,7 @@ function MeshImportDialog({ req, onImport, notify }: { req: MeshImportRequest }
|
||||
|
||||
return (
|
||||
<div className="imp-overlay" onClick={() => closeMeshImport()}>
|
||||
<div className="imp-dialog" role="dialog" aria-modal="true" aria-label={t("mesh.import.title")} onClick={(e) => e.stopPropagation()}>
|
||||
<div className="imp-dialog" ref={dialogRef} role="dialog" aria-modal="true" aria-label={t("mesh.import.title")} onClick={(e) => e.stopPropagation()}>
|
||||
<header className="imp-head">
|
||||
<span className="imp-head-title">{t("mesh.import.title")}</span>
|
||||
<button className="imp-close" onClick={() => closeMeshImport()} aria-label={t("export.close")}>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import { memo, useEffect, useState } from "react";
|
||||
import { useStore } from "../state/appStore";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { Dropdown } from "./Dropdown";
|
||||
import { DEFAULT_MAX_POINTS, POINT_CLOUD_EXTENSIONS, readPointCloud } from "../io/pointCloud";
|
||||
@@ -58,6 +59,7 @@ function PointCloudImportDialog({ file, project }: { file: File; project: Projec
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [result, setResult] = useState<PointCloudData | null>(null);
|
||||
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") closePointCloudImport();
|
||||
@@ -104,7 +106,7 @@ function PointCloudImportDialog({ file, project }: { file: File; project: Projec
|
||||
<div className="imp-overlay" onClick={() => closePointCloudImport()}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("pointCloud.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import { memo, useCallback, useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import { PRESENTATION_SCALES, levelHasContent, presentationDefaults, type PresentationOptions } from "../core";
|
||||
import type { LayoutOrientation, LayoutPaperFormat } from "../model/types";
|
||||
import { PAPER_FORMAT_GROUPS } from "../model/layoutModel";
|
||||
@@ -36,6 +37,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
if (id) onCreated(id);
|
||||
}, [opts, onCreated]);
|
||||
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
if (!opts) return;
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
@@ -68,7 +70,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
set({ scales: next });
|
||||
};
|
||||
const scaleSelect = (id: string) => (
|
||||
<select className="imp-select" style={{ marginLeft: "auto" }} data-testid={`presentation-scale-${id}`} value={scaleOf(id)} onChange={(e) => setScaleOf(id, e.target.value)}>
|
||||
<select className="imp-select" style={{ marginLeft: "auto" }} data-testid={`presentation-scale-${id}`} aria-label={`${t("export.scale")} ${drawingLevels.find((l) => l.id === id)?.name ?? ""}`.trim()} value={scaleOf(id)} onChange={(e) => setScaleOf(id, e.target.value)}>
|
||||
<option value="">{t("presentation.scale.common")}</option>
|
||||
{PRESENTATION_SCALES.map((n) => (
|
||||
<option key={n} value={n}>{`1:${n}`}</option>
|
||||
@@ -81,6 +83,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
<div className="imp-overlay" onClick={close}>
|
||||
<div
|
||||
className="imp-dialog presentation-dialog"
|
||||
ref={dialogRef}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("presentation.title")}
|
||||
@@ -130,6 +133,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
<select
|
||||
className="imp-select"
|
||||
data-testid="presentation-section"
|
||||
aria-label={t("presentation.section")}
|
||||
value={opts.sectionId ?? ""}
|
||||
onChange={(e) => set({ sectionId: e.target.value || null })}
|
||||
>
|
||||
@@ -148,6 +152,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
<select
|
||||
className="imp-select"
|
||||
data-testid="presentation-target"
|
||||
aria-label={t("presentation.sheet")}
|
||||
value={opts.poster ?? ""}
|
||||
onChange={(e) => set({ poster: e.target.value || undefined })}
|
||||
>
|
||||
@@ -161,6 +166,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
<select
|
||||
className="imp-select"
|
||||
data-testid="presentation-scale"
|
||||
aria-label={t("export.scale")}
|
||||
value={opts.scale ?? ""}
|
||||
onChange={(e) => set({ scale: e.target.value ? Number(e.target.value) : null })}
|
||||
>
|
||||
@@ -174,6 +180,7 @@ export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
<select
|
||||
className="imp-select"
|
||||
data-testid="presentation-paper"
|
||||
aria-label={t("export.paper")}
|
||||
value={opts.paper}
|
||||
disabled={poster}
|
||||
onChange={(e) => set({ paper: e.target.value as LayoutPaperFormat })}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
|
||||
export interface PromptDialogProps {
|
||||
/** Kopfzeile des Dialogs. */
|
||||
@@ -32,6 +33,7 @@ export function PromptDialog({
|
||||
}: PromptDialogProps) {
|
||||
const [value, setValue] = useState(defaultValue);
|
||||
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -49,7 +51,7 @@ export function PromptDialog({
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={title}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
@@ -67,7 +69,8 @@ export function PromptDialog({
|
||||
<input
|
||||
className="settings-num-input"
|
||||
type={type}
|
||||
autoFocus
|
||||
aria-label={label}
|
||||
data-autofocus
|
||||
spellCheck={false}
|
||||
value={value}
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
|
||||
export interface RecoverAutosaveDialogProps {
|
||||
/** Dateipfad der Kopie (null = nie gespeichertes Projekt). */
|
||||
@@ -15,6 +16,7 @@ export interface RecoverAutosaveDialogProps {
|
||||
}
|
||||
|
||||
export function RecoverAutosaveDialog({ path, savedAt, onRestore, onDiscard, onLater }: RecoverAutosaveDialogProps) {
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onLater();
|
||||
@@ -30,7 +32,7 @@ export function RecoverAutosaveDialog({ path, savedAt, onRestore, onDiscard, onL
|
||||
<div className="imp-overlay recover-overlay" onClick={onLater}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("recover.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import type { TranslationKey } from "../i18n";
|
||||
import { roomProgramOps, cellText, importedRows, mapRows, PROGRAM_FIELDS, readSheetFile, suggestMapping } from "../core";
|
||||
import type { CoreOp, ImportMode, Mapping, ProgramField, SheetData, SkipReason } from "../core";
|
||||
@@ -61,6 +62,7 @@ export function RoomProgramImportDialog({ fileName, sheets, existing, onImport,
|
||||
const [skipSums, setSkipSums] = useState(true);
|
||||
const [mode, setMode] = useState<ImportMode>(existing > 0 ? "append" : "replace");
|
||||
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -94,7 +96,7 @@ export function RoomProgramImportDialog({ fileName, sheets, existing, onImport,
|
||||
|
||||
const dialog = (
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div className="imp-dialog rpi-dialog" role="dialog" aria-modal="true" aria-label={t("program.import.title")} onClick={(e) => e.stopPropagation()}>
|
||||
<div className="imp-dialog rpi-dialog" ref={dialogRef} role="dialog" aria-modal="true" aria-label={t("program.import.title")} onClick={(e) => e.stopPropagation()}>
|
||||
<header className="imp-head">
|
||||
<span className="imp-head-title">{t("program.import.title")}</span>
|
||||
<button className="imp-close" onClick={onClose} aria-label={t("export.close")}>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t, type TranslationKey } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import { ACCENT_SWATCHES } from "../theme/accents";
|
||||
import { ColorHexField } from "./ColorHexField";
|
||||
import { LayoutMenu } from "./LayoutMenu";
|
||||
@@ -161,6 +162,7 @@ export function SettingsDialog({
|
||||
});
|
||||
}, []);
|
||||
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -196,7 +198,7 @@ export function SettingsDialog({
|
||||
const dialog = (
|
||||
<div
|
||||
className={`imp-dialog${windowed ? " imp-dialog-embedded" : ""}`}
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("settings.title")}
|
||||
onClick={windowed ? undefined : (e) => e.stopPropagation()}
|
||||
@@ -523,6 +525,7 @@ function AliasRemapSection({ onChange }: { onChange?: (overrides: Record<string,
|
||||
<span className="settings-alias-arrow">→</span>
|
||||
<select
|
||||
className="settings-select"
|
||||
aria-label={t("settings.shortcuts.pickCommand")}
|
||||
value={cmd}
|
||||
onChange={(e) => commit({ ...overrides, [key]: e.target.value })}
|
||||
>
|
||||
@@ -548,6 +551,7 @@ function AliasRemapSection({ onChange }: { onChange?: (overrides: Record<string,
|
||||
<div className="settings-alias-row settings-alias-new">
|
||||
<input
|
||||
type="text"
|
||||
aria-label={t("settings.shortcuts.newKey")}
|
||||
className="settings-num-input settings-alias-key-input"
|
||||
value={newKey}
|
||||
onChange={(e) => setNewKey(e.target.value)}
|
||||
@@ -556,6 +560,7 @@ function AliasRemapSection({ onChange }: { onChange?: (overrides: Record<string,
|
||||
<span className="settings-alias-arrow">→</span>
|
||||
<select
|
||||
className="settings-select"
|
||||
aria-label={t("settings.shortcuts.pickCommand")}
|
||||
value={newCommand}
|
||||
onChange={(e) => setNewCommand(e.target.value)}
|
||||
>
|
||||
|
||||
+3
-1
@@ -10,6 +10,7 @@
|
||||
|
||||
import { TEXT_FONTS } from "../text/fontList";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import { checkForUpdate } from "../update/checkForUpdate";
|
||||
import { getRunningVersion } from "../update/version";
|
||||
import { memo, useEffect, useRef, useState } from "react";
|
||||
@@ -942,6 +943,7 @@ function AboutDialog({ onClose }: { onClose: () => void }) {
|
||||
useEffect(() => {
|
||||
void getRunningVersion().then(setRunningVersion);
|
||||
}, []);
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -961,7 +963,7 @@ function AboutDialog({ onClose }: { onClose: () => void }) {
|
||||
<div className="about-overlay" onMouseDown={onClose}>
|
||||
<div
|
||||
className="about-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("about.title")}
|
||||
onMouseDown={(e) => e.stopPropagation()}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
|
||||
export interface UnsavedChangesDialogProps {
|
||||
/** Speichert das aktuelle Projekt; liefert `true` nur bei echtem Erfolg
|
||||
@@ -18,6 +19,7 @@ export interface UnsavedChangesDialogProps {
|
||||
export function UnsavedChangesDialog({ onSave, onDiscard, onCancel }: UnsavedChangesDialogProps) {
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onCancel();
|
||||
@@ -39,7 +41,7 @@ export function UnsavedChangesDialog({ onSave, onDiscard, onCancel }: UnsavedCha
|
||||
<div className="imp-overlay" onClick={onCancel}>
|
||||
<div
|
||||
className="imp-dialog"
|
||||
role="dialog"
|
||||
ref={dialogRef} role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("unsaved.title")}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { createPortal } from "react-dom";
|
||||
import type { Project } from "../../model/types";
|
||||
import { standardsChangeKey, standardsUpdatePlan } from "../../model/standards";
|
||||
import { t } from "../../i18n";
|
||||
import { useModalFocus } from "../modalFocus";
|
||||
|
||||
const COLLECTION_ORDER = ["components", "hatches", "lineStyles", "wallTypes", "ceilingTypes", "roofTypes", "viewTemplates"];
|
||||
|
||||
@@ -24,6 +25,7 @@ export function StandardsUpdateDialog({
|
||||
const [selected, setSelected] = useState<Set<string>>(
|
||||
() => new Set(plan.changes.filter((c) => !c.renamed).map(standardsChangeKey)),
|
||||
);
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
@@ -45,7 +47,7 @@ export function StandardsUpdateDialog({
|
||||
|
||||
return createPortal(
|
||||
<div className="imp-overlay" onClick={onClose}>
|
||||
<div className="imp-dialog" role="dialog" aria-modal="true" aria-label={t("resources.updateStandards")} style={{ maxWidth: 560 }} onClick={(e) => e.stopPropagation()}>
|
||||
<div className="imp-dialog" ref={dialogRef} role="dialog" aria-modal="true" aria-label={t("resources.updateStandards")} style={{ maxWidth: 560 }} onClick={(e) => e.stopPropagation()}>
|
||||
<header className="imp-head">
|
||||
<span className="imp-head-title">{t("resources.updateStandards")}</span>
|
||||
<button className="imp-close" onClick={onClose} aria-label={t("export.close")}>
|
||||
|
||||
Reference in new issue
Block a user