ARIA Labels Done Wrong: Common Accessibility Mistakes in Production
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
- Redundant aria-labels: 70% of aria-label misuse involves duplicating visible text, which causes screen readers to announce information twice.
- Semantic HTML over ARIA: Standard HTML elements like
- Silent Failures: Broken aria-labelledby references pointing to non-existent IDs result in empty computed names in the accessibility tree, detectable via Chrome DevTools.
- Dynamic Content Gaps: 50% of single-page apps fail to use aria-live regions, leaving screen reader users unaware of content updates like form validation errors or notifications.
- The aria-hidden Conflict: Setting aria-hidden=‘true’ on focusable elements allows keyboard users to reach components that screen readers ignore, causing significant navigation confusion.
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
Why Semantic HTML Buttons Outperform Divs with ARIA Roles for Accessibility
Using <button> instead of <div role='button'> improves accessibility by 80% in keyboard and screen reader interactions.
Checkbox Aria TagHelper for ASP.NET Core Accessibility
ASP.NET Core TagHelper ensures checkboxes are accessible to screen readers by syncing aria-checked attributes.
Engineering Accessible Email Marketing: A Technical Implementation Guide
Learn to implement accessible email marketing to reach 2.2 billion vision-impaired users and comply with the June 2025 European Accessibility Act.