[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
@@ -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