What is ARIA in HTML: Accessibility Explained Simply
ARIA stands for Accessible Rich Internet Applications. It is a set of special attributes that help make web content easier to understand and use for people with disabilities by improving how assistive technologies like screen readers interpret the page.How It Works
Think of ARIA as a helpful guide that tells assistive tools more about the parts of a webpage. Just like a tour guide explains what you see in a museum, ARIA attributes explain the role and state of elements on a page to screen readers.
For example, if a button is disabled or a section is expanded, ARIA attributes communicate this clearly to users who cannot see the page. This way, everyone understands the page's structure and functionality, even if they rely on special technology to browse.
Example
This example shows a button with an ARIA attribute that tells screen readers it is currently pressed.
<button aria-pressed="true">Toggle</button>When to Use
Use ARIA when native HTML elements do not fully describe the purpose or state of a part of your webpage. It is especially useful for custom widgets like sliders, tabs, or menus that need extra explanation for assistive devices.
For example, if you create a custom dropdown menu with divs instead of the native <select> element, ARIA attributes help screen readers understand how to interact with it.
Key Points
- ARIA attributes improve accessibility by describing roles, states, and properties.
- They help assistive technologies understand custom or complex UI elements.
- Use ARIA only when native HTML does not provide the needed accessibility.
- Common ARIA attributes include
aria-label,aria-hidden, andaria-expanded.