Skip to main content

On This Page

ARIA Labels Done Wrong: Common Accessibility Mistakes in Production

3 min read
Share

These articles are AI-generated summaries. Please check the original sources for full details.

ARIA Labels Done Wrong: The Most Common Mistakes I See in Production Code

Frontend developer Priya Nair reports that 70% of ARIA usage in audited codebases is unnecessary or broken. This misuse creates a confusing experience for screen reader users rather than the intended accessibility improvement.

Why This Matters

The technical reality is that developers frequently use ARIA as a shim to fix inaccessible foundations, such as using aria-label on non-semantic div elements. This approach fails because ARIA does not provide the inherent keyboard focus or event handling of semantic HTML, leading to 30% of custom button roles lacking basic keyboard support. If a feature requires ARIA to function, it is often a sign of poor underlying HTML architecture. Adhering to the ‘First Rule of ARIA’—that no ARIA is better than bad ARIA—is critical to preventing broken accessibility trees in production environments.

Key Insights

Working Examples

Correct implementation of an icon-only button using aria-label to provide context.

<button aria-label="Close dialog" class="close-button">
  <i class="icon-x"></i>
</button>

Required manual keyboard handling for non-semantic elements using role=‘button’.

const fakeButton = document.querySelector('[role="button"]');
fakeButton.addEventListener('keydown', (e) => {
  if (e.key === 'Enter' || e.key === ' ') {
    e.preventDefault();
    fakeButton.click();
  }
});

A live region implementation for announcing dynamic content updates without interrupting the user.

<div id="notifications" aria-live="polite" aria-atomic="true">
  <!-- Initially empty -->
</div>

Practical Applications

  • Icon-only buttons: Implement aria-label on SVG or icon-font buttons to ensure screen readers announce purpose. Pitfall: Leaving these buttons unlabeled results in the reader only announcing ‘button’.
  • Custom interactive elements: If using role=‘button’, you must manually add tabindex=‘0’ and keyboard listeners. Pitfall: Forgetting these additions makes the element inaccessible to keyboard-only users.
  • Dynamic notifications: Use role=‘alert’ for urgent errors and aria-live=‘polite’ for status changes. Pitfall: Updating DOM content without live regions results in silent changes for assistive technology users.

References:

Continue reading

Next article

Essential JavaScript Array Methods for Efficient Data Manipulation

Related Content