Skip to content

fix(a11y): make comment permalink button keyboard-visible and named - #67

Merged
royalpinto007 merged 2 commits into
AgentPostmortem:mainfrom
waterlemonnn:fix/comment-anchor-a11y
Aug 7, 2026
Merged

fix(a11y): make comment permalink button keyboard-visible and named#67
royalpinto007 merged 2 commits into
AgentPostmortem:mainfrom
waterlemonnn:fix/comment-anchor-a11y

Conversation

@waterlemonnn

Copy link
Copy Markdown
Contributor

Closes #28.

CommentAnchorLink in components/post/CommentsSection.tsx was only revealed on group-hover, so a keyboard user tabbing to it focused an invisible control with no visible focus indicator (WCAG 2.4.7). Its accessible name was also just the # character via title, which isn't a reliable accessible name and isn't surfaced on touch/keyboard.

  • Added focus-visible:opacity-100 alongside the existing group-hover:opacity-100 so focus reveals the button.
  • Replaced title with aria-label="Copy link to this comment", and wrapped the visible #/Copied glyph in aria-hidden="true".
  • Added an aria-live="polite" sr-only span that announces "Copied" when the state flips, so screen reader users get feedback too.

Test plan

  • npm run lint — clean
  • npx tsc --noEmit — clean
  • npx vitest run — 87/87 passing (no existing coverage for this component)

CommentAnchorLink only revealed on hover, so a focused button had no
visible indicator (WCAG 2.4.7), and its accessible name was the "#"
character via title. Add focus-visible:opacity-100, swap title for
aria-label, hide the glyph from assistive tech, and announce the
copied state via a live region.
@royalpinto007 royalpinto007 changed the title a11y: make comment permalink button keyboard-visible and named fix(a11y): make comment permalink button keyboard-visible and named Aug 7, 2026
AgentPostmortem#66 landed first and added a "Failed" state to the same button this
branch makes accessible, so the two collided on one line.

Resolved by combining them rather than picking a side: the visible span
still shows Copied / Failed / #, and the sr-only live region now
announces "Failed to copy" as well as "Copied". Taking either side alone
would have dropped one of the two fixes.
@royalpinto007
royalpinto007 merged commit 779bd69 into AgentPostmortem:main Aug 7, 2026
5 checks passed
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Nice work @waterlemonnn, this is merged.

agentpostmortem gets better every time someone outside the repo digs in like this.

If you find agentpostmortem useful, consider dropping a star. It helps more people find it.

Happy to see more from you whenever you have the time.

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.

a11y: per-comment permalink button is invisible on keyboard focus and named only "#"

2 participants