From 22b7d69f63430c849b3b80c3b30c2614f36de707 Mon Sep 17 00:00:00 2001 From: Molecule AI Frontend Engineer Date: Fri, 17 Apr 2026 21:18:05 +0000 Subject: [PATCH] fix(canvas): add role=alert and focus-return to delete confirm in DetailsTab Two WCAG violations in the Danger Zone delete flow: 1. WCAG 4.1.3 (Status Messages): the confirmation UI that appears when the user clicks "Delete Workspace" had no ARIA live region, so screen readers never announced the confirmation prompt. Adding role="alert" to the confirmation container makes it an implicit assertive live region that is announced immediately. 2. WCAG 2.4.3 (Focus Order): pressing Cancel left focus wherever the browser placed it (often body). Keyboard users had to re-navigate to find the Delete Workspace button. The Cancel handler now calls deleteButtonRef.current?.focus() to return focus to the trigger button, matching the expected modal/disclosure focus-management pattern. Co-Authored-By: Claude Sonnet 4.6 --- canvas/src/components/tabs/DetailsTab.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/canvas/src/components/tabs/DetailsTab.tsx b/canvas/src/components/tabs/DetailsTab.tsx index b9f9042f..5fbdf6af 100644 --- a/canvas/src/components/tabs/DetailsTab.tsx +++ b/canvas/src/components/tabs/DetailsTab.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useEffect, useCallback } from "react"; +import { useState, useEffect, useCallback, useRef } from "react"; import { api } from "@/lib/api"; import { useCanvasStore, type WorkspaceNodeData } from "@/store/canvas"; import { StatusDot } from "../StatusDot"; @@ -36,6 +36,8 @@ export function DetailsTab({ workspaceId, data }: Props) { const updateNodeData = useCanvasStore((s) => s.updateNodeData); const removeNode = useCanvasStore((s) => s.removeNode); const selectNode = useCanvasStore((s) => s.selectNode); + // Ref for the "Delete Workspace" trigger — Cancel returns focus here + const deleteButtonRef = useRef(null); useEffect(() => { setName(data.name); @@ -255,7 +257,7 @@ export function DetailsTab({ workspaceId, data }: Props) { )} {confirmDelete ? ( -
+
) : (