[249] Tastatur und Fokus in den neuen Dialogen und Leisten: gemeinsame Fokus-Hülle, Fokusring, aria, Hintergrund-Kürzel gesperrt
This commit is contained in:
24 files changed
+862
-103
No files matched your search
@@ -19,7 +19,8 @@ describe("ViewportToolbar3d", () => {
|
||||
const h = html(false);
|
||||
expect(h).toContain('role="toolbar"');
|
||||
expect(h).toContain('aria-pressed="false"');
|
||||
expect(h).toContain(`aria-label="${t("walk.tip.on")}"`);
|
||||
// [249] Stabiler Name + aria-pressed (kein wechselnder aria-label), der Zustandstext steht im Tooltip.
|
||||
expect(h).toContain(`aria-label="${t("walk.toggle")}"`);
|
||||
expect(h).toContain(`data-tip="${t("walk.tip.on")}"`);
|
||||
expect(h).not.toContain("walk-help");
|
||||
expect(h).not.toContain("is-on");
|
||||
|
||||
@@ -63,7 +63,10 @@ function useThrottledValue<T>(value: T, ms: number, force: boolean): T {
|
||||
|
||||
function ToolButton(props: {
|
||||
icon: string;
|
||||
/** Tooltip (Zustandstext, z. B. „Begehen beenden“). */
|
||||
label: string;
|
||||
/** [249] Stabiler Name für Screenreader; Umschalter melden den Zustand über `aria-pressed`, nicht über wechselnde Namen. */
|
||||
name?: string;
|
||||
testId: string;
|
||||
on?: boolean;
|
||||
pressed?: boolean;
|
||||
@@ -73,7 +76,7 @@ function ToolButton(props: {
|
||||
<button
|
||||
type="button"
|
||||
className={`vp3t-btn${props.on ? " is-on" : ""}`}
|
||||
aria-label={props.label}
|
||||
aria-label={props.name ?? props.label}
|
||||
aria-pressed={props.pressed}
|
||||
data-tip={props.label}
|
||||
data-testid={props.testId}
|
||||
@@ -155,6 +158,7 @@ export function ViewportToolbar3d({ walkMode, onToggleWalk, ghost = false, onTog
|
||||
<ToolButton
|
||||
icon="directions_walk"
|
||||
label={walkMode ? t("walk.tip.off") : t("walk.tip.on")}
|
||||
name={t("walk.toggle")}
|
||||
testId="walk-toggle"
|
||||
on={walkMode}
|
||||
pressed={walkMode}
|
||||
@@ -164,6 +168,7 @@ export function ViewportToolbar3d({ walkMode, onToggleWalk, ghost = false, onTog
|
||||
<ToolButton
|
||||
icon="ghost"
|
||||
label={ghost ? t("walk.tip.ghostOff") : t("walk.tip.ghostOn")}
|
||||
name={t("walk.help.ghost")}
|
||||
testId="walk-ghost"
|
||||
on={ghost}
|
||||
pressed={ghost}
|
||||
|
||||
@@ -114,7 +114,9 @@ export function walkKeyAllowed(e: { ctrlKey: boolean; metaKey: boolean }, active
|
||||
if (!active) return true;
|
||||
const tag = active.tagName;
|
||||
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return false;
|
||||
return !(active as HTMLElement).isContentEditable;
|
||||
if ((active as HTMLElement).isContentEditable) return false;
|
||||
// [249] Liegt der Fokus in einem modalen Dialog, gehören die Tasten dem Dialog (kein Gehen im Hintergrund).
|
||||
return !(typeof active.closest === "function" && active.closest('[aria-modal="true"]'));
|
||||
}
|
||||
|
||||
// ── [245] Kollision und Bodenfolge ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user