Skip to content

fix(a11y): label icon-only card and battle actions - #8

Open
LangerSword wants to merge 2 commits into
mainfrom
fix/aria-labels-issue-1
Open

LangerSword wants to merge 2 commits into
mainfrom
fix/aria-labels-issue-1

Conversation

@LangerSword

@LangerSword LangerSword commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Fixes #1.

Problem: Copy, link and embed actions lost their name when visible text changed to "Copied".
Change: Add stable aria-labels to copy image, copy link, embed and JSON actions. Visible text stays the same.
Test: Render card and battle actions. Check icon-only names and menu item names.
Checks: npm test 41 pass. tsc clean. build passes.
Credit: LangerSword

@github-actions

Copy link
Copy Markdown

Rook / automated review

Verdict
ship, high confidence on the production change. The merge call stays with the maintainer.

Findings

  1. P2|tests/actions-a11y.test.ts:76|high|The "keeps the visible copy unchanged" test asserts on raw HTML. Line 76 checks that cardHtml contains "Copy embed Markdown". Line 77 checks "Copy JSON API URL". This diff adds those exact strings as aria-label values at components/CardActions.tsx:64 and components/CardActions.tsx:78. toContain passes on the attribute alone. Visible text could be deleted and the test would still pass. Fix: assert on visibleText(cardHtml) and visibleText(battleHtml). The helper at line 36 strips tags and attributes, so it leaves text nodes only.

  2. P3|tests/actions-a11y.test.ts:66|high|The test name claims it covers "when their text flashes to Copied". The body only checks static aria-label values. It never renders the copied state. The flash logic sits in useImageActions, which is outside the diff, so I cannot verify it here. Fix: rename the test to describe label presence, or render the copied state and assert the accessible name stays stable. The label does make the name stable, so this is a scope gap, not a functional defect.

Open questions

Do copy or link actions in other components flash to "Copied" without a stable label? The diff touches only CardActions and SplitDownload. I cannot see other call sites in the diff. If such actions exist, the fix is incomplete.

Test gaps

I did not run npm test, typecheck, or the build. The PR claims 41 passing tests, clean tsc, and a passing build. I cannot confirm those from the diff. Run those commands before merge.

No test renders the "Copied" flash. Add a test that triggers copy and checks the accessible name stays "Copy image", "Copy link", "Copy embed Markdown", and "Copy JSON API URL".

Evidence boundary: I reviewed only the diff. The useImageActions hook and BattleActions internals are not in it. I checked no sibling call sites beyond the two changed components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add aria-labels to icon-only actions

1 participant