Merge pull request #938 from Molecule-AI/fix/a11y-team-member-chip

fix(canvas): add a11y to TeamMemberChip — keyboard nav + ARIA
This commit is contained in:
Hongming Wang 2026-04-17 21:53:54 -07:00 committed by GitHub
commit c871e1209a
2 changed files with 13 additions and 3 deletions

View File

@ -344,11 +344,21 @@ function TeamMemberChip({
return (
<div
className="group/child relative rounded-lg bg-zinc-800/60 hover:bg-zinc-700/70 border border-zinc-700/30 hover:border-zinc-600/40 overflow-hidden transition-colors cursor-pointer"
role="button"
tabIndex={0}
aria-label={`Select ${data.name}`}
className="group/child relative rounded-lg bg-zinc-800/60 hover:bg-zinc-700/70 border border-zinc-700/30 hover:border-zinc-600/40 overflow-hidden transition-colors cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/70"
onClick={(e) => {
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();

View File

@ -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 <name> from team'", () => {
renderParentNode();
const ejectBtn = screen.getByRole("button", {
name: "Extract from team",
name: "Extract Child Workspace from team",
});
expect(ejectBtn).toBeTruthy();
});