Claude Skills Guide

Claude Code ARIA Labels Implementation Guide

Accessibility in web development requires more than semantic HTML. ARIA (Accessible Rich Internet Applications) labels bridge the gap between complex UI components and assistive technologies. This guide shows you how to implement ARIA labels effectively using Claude Code and complementary skills.

Understanding ARIA Labels

ARIA labels provide accessible names for interactive elements that lack visible text. They help screen readers convey meaning to users who cannot see visual labels. The key attributes include:

<button aria-label="Close dialog"></button>
<input aria-label="Search" type="text" placeholder="Search...">
<div role="alert" aria-live="polite">Changes saved</div>

Setting Up Your Environment

Before implementing ARIA labels, configure Claude Code with skills that support accessible development. The frontend-design skill provides templates and patterns for accessible components. Install it first:

# Place frontend-design.md in .claude/ then invoke: /frontend-design

For testing your implementation, the tdd skill helps create automated accessibility tests:

# Place tdd.md in .claude/ then invoke: /tdd

These skills work together—the frontend-design skill generates markup with proper ARIA attributes, while tdd skill tests verify they function correctly.

Implementing ARIA Labels in Practice

Form Elements

Forms often contain inputs without visible labels. Always pair each input with an accessible name:

<!-- Without ARIA - problematic for screen readers -->
<input type="email" placeholder="Enter your email">

<!-- With aria-label -->
<input type="email" aria-label="Email address" placeholder="Enter your email">

<!-- Using aria-labelledby for existing text -->
<label id="email-label">Email Address</label>
<input type="email" aria-labelledby="email-label">

The pdf skill can generate accessibility reports from your HTML, helping you verify form labels are correctly implemented across your application.

Icon Buttons

Buttons that use only icons confuse screen reader users. Add aria-label to icon buttons:

<!-- Social media icons without labels -->
<button><svg>...</svg></button>

<!-- With accessible names -->
<button aria-label="Share on Twitter">
  <svg aria-hidden="true">...</svg>
</button>
<button aria-label="Share on Facebook">
  <svg aria-hidden="true">...</svg>
</button>

Note the aria-hidden="true" on the SVG. This prevents the icon’s path data from being read aloud, keeping only your button’s label audible.

Modals require careful ARIA implementation. Set appropriate roles and manage focus:

<div role="dialog" 
     aria-modal="true" 
     aria-labelledby="modal-title"
     aria-describedby="modal-description">
  <h2 id="modal-title">Confirm Deletion</h2>
  <p id="modal-description">This action cannot be undone.</p>
  <button>Cancel</button>
  <button>Delete</button>
</div>

The supermemory skill can help you recall patterns for modal accessibility you’ve used in previous projects, maintaining consistency across your codebase.

Testing ARIA Implementation

Automated testing catches many ARIA issues early. Use the tdd skill to write tests:

// accessibility.test.js
test('icon buttons have aria-labels', () => {
  const buttons = document.querySelectorAll('button svg');
  buttons.forEach(button => {
    const parent = button.closest('button');
    const hasLabel = parent.hasAttribute('aria-label') || 
                     parent.hasAttribute('aria-labelledby');
    expect(hasLabel).toBe(true);
  });
});

test('modals have proper ARIA attributes', () => {
  const modal = document.querySelector('[role="dialog"]');
  expect(modal).toHaveAttribute('aria-modal', 'true');
  expect(modal).toHaveAttribute('aria-labelledby');
});

Run these tests as part of your CI pipeline to catch regressions. The canvas-design skill can help create visual accessibility documentation for your team.

Common Mistakes to Avoid

Several patterns undermine accessibility efforts:

  1. Redundant labels: Using both aria-label and a child <img> with alt text creates confusing announcements
  2. Missing associations: Inputs without any label connection fail WCAG compliance
  3. Overusing roles: Native HTML elements like <button> already have correct roles—don’t add ARIA roles unless necessary
<!-- Wrong: redundant label -->
<button aria-label="Submit">
  <svg>submit-icon</svg>
  Submit
</button>

<!-- Correct: visible text alone is sufficient -->
<button>Submit</button>

Generating Accessibility Documentation

After implementing ARIA labels, document your components for other developers. The pdf skill generates formatted documentation:

claude --print "/pdf"
claude "Generate accessibility documentation for components in components/"

This creates a reference guide showing which ARIA attributes each component uses, making maintenance easier for your team.

Advanced Patterns

Dynamic Content

For content that updates dynamically, use aria-live regions:

<div aria-live="polite" aria-atomic="true">
  <span id="status">Loading...</span>
</div>

The polite setting announces changes without interrupting, while atomic ensures the entire region is re-announced when content changes.

Compound Components

When building compound components like tabs or accordions, coordinate ARIA attributes across elements:

<div role="tablist">
  <button role="tab" 
          aria-selected="true" 
          aria-controls="panel-1"
          id="tab-1">
    Overview
  </button>
  <button role="tab" 
          aria-selected="false" 
          aria-controls="panel-2"
          id="tab-2">
    Details
  </button>
</div>
<div role="tabpanel" 
     id="panel-1" 
     aria-labelledby="tab-1">
  <!-- Panel content -->
</div>

Conclusion

Implementing ARIA labels correctly requires understanding both the attributes available and the assistive technology patterns they support. Start with semantic HTML, add ARIA labels where visual text is absent, and test with both automated tools and manual screen reader testing.

The combination of skills like frontend-design for component patterns, tdd for verification, and pdf for documentation creates a workflow that maintains accessibility as your project grows. Remember: accessible interfaces benefit everyone, not just screen reader users.

Built by theluckystrike — More at zovo.one