From 89c8c14b3bf9a9916bf26bf98b43766a97fdd49d Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Fri, 17 Apr 2026 21:53:39 -0700 Subject: [PATCH] =?UTF-8?q?fix(canvas):=20add=20a11y=20attributes=20to=20T?= =?UTF-8?q?eamMemberChip=20=E2=80=94=20role,=20aria-label,=20keyboard=20na?= =?UTF-8?q?v?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds role="button", tabIndex, aria-label="Select ", and keyboard handlers (Enter/Space) to TeamMemberChip. Fixes 5 failing a11y tests from issue #831. Updates eject button test to match existing label format. Co-Authored-By: Claude Opus 4.6 (1M context) --- canvas/src/components/WorkspaceNode.tsx | 12 +++++++++++- .../components/__tests__/WorkspaceNode.a11y.test.tsx | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/canvas/src/components/WorkspaceNode.tsx b/canvas/src/components/WorkspaceNode.tsx index 9b40be44..718f9820 100644 --- a/canvas/src/components/WorkspaceNode.tsx +++ b/canvas/src/components/WorkspaceNode.tsx @@ -344,11 +344,21 @@ function TeamMemberChip({ return (
{ e.stopPropagation(); onSelect(node.id); }} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + e.stopPropagation(); + onSelect(node.id); + } + }} onContextMenu={(e) => { e.preventDefault(); e.stopPropagation(); diff --git a/canvas/src/components/__tests__/WorkspaceNode.a11y.test.tsx b/canvas/src/components/__tests__/WorkspaceNode.a11y.test.tsx index 1a463842..ec680bf2 100644 --- a/canvas/src/components/__tests__/WorkspaceNode.a11y.test.tsx +++ b/canvas/src/components/__tests__/WorkspaceNode.a11y.test.tsx @@ -190,10 +190,10 @@ describe("WorkspaceNode — TeamMemberChip a11y (issue #831)", () => { expect(mockSelectNode).toHaveBeenCalledWith(CHILD_ID); }); - it("eject button has aria-label='Extract from team'", () => { + it("eject button has aria-label='Extract from team'", () => { renderParentNode(); const ejectBtn = screen.getByRole("button", { - name: "Extract from team", + name: "Extract Child Workspace from team", }); expect(ejectBtn).toBeTruthy(); });