Skip to content

a11y: add accessible names (aria-label) to icon-only buttons #221

Closed

Description

@gkhngyk

What

Many icon-only buttons (<Button size="icon"> wrapping a lucide icon) have no accessible name, so screen readers announce them as just "button" with no indication of what they do. The repo has ~25 size="icon" buttons but only ~13 aria-labels total (some of which are on non-button elements), and the worst-offending files have no aria-label, title, or sr-only fallback at all.

This is a WCAG 2.1 4.1.2 (Name, Role, Value) gap. Concrete examples (all bare <Button size="icon"><Icon /></Button> with no label):

  • brands/[id]/settings/page.tsx — domain delete (<Trash2 />), add-domain, etc.
  • components/dashboard/prompt-suggestion-card.tsx — save (<Check />) and cancel (<X />)
  • brands/[id]/topics/page.tsx — edit/delete/confirm/cancel

Files with icon-only buttons (add labels where missing)

File size="icon" buttons
web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/settings/page.tsx 5
web/src/components/dashboard/prompt-suggestion-card.tsx 4
web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/topics/page.tsx 4
web/src/app/[locale]/(dashboard)/dashboard/competitors/page.tsx 3
web/src/app/[locale]/(dashboard)/dashboard/prompts/_suggestions-card.tsx 2
web/src/app/[locale]/(dashboard)/dashboard/insights/page.tsx 2
web/src/components/layout/mobile-nav.tsx 1
web/src/app/[locale]/(dashboard)/dashboard/traffic/page.tsx 1
web/src/app/[locale]/(dashboard)/dashboard/prompts/[id]/page.tsx 1
web/src/app/[locale]/(dashboard)/dashboard/content/[id]/page.tsx 1
web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/layout.tsx 1

(Some already have a label; the goal is to make sure every icon-only button has one. A few aria-labels also exist on non-button elements, so the real gap is larger than "25 − 13".)

Fix

Give each icon-only button an accessible name describing its action (not the icon), via aria-label:

<Button variant="ghost" size="icon" aria-label="Delete domain" onClick={...}>
  <Trash2 className="h-3.5 w-3.5" />
</Button>

Use concrete, action-oriented labels: Delete domain, Save prompt, Cancel edit, Copy snippet, Edit, Go back, etc. (An <span className="sr-only">…</span> child is an acceptable alternative.) Decorative icons inside labeled buttons can stay as-is.

Acceptance

  • Every <Button size="icon"> in the files above has an accessible name (aria-label or sr-only text)
  • Labels describe the action, not the icon
  • No visual change
  • (Optional) Add the jsx-a11y/control-has-associated-label ESLint rule to catch regressions going forward

Notes

  • Accessibility-only change; no behavior or layout changes.

Activity

  1. added
    enhancement
    good first issue
    on Jun 10, 2026
  2. BharadwajKanneveti commented on Jun 13, 2026

    @BharadwajKanneveti
    Contributor

    Hi @gkhngyk Can I work on this issue?

  3. gkhngyk commented on Jun 13, 2026

    @gkhngyk
    ContributorAuthor

    Hi, thanks for your interest! Sure, feel free to take this one.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions