ARIA (Accessible Rich Internet Applications) is a set of attributes that can be added to HTML elements to make web content and applications more accessible to people with disabilities. ARIA provides additional information to assistive technologies (such as screen readers) to help users better understand and interact with web content. Below is an explanation of ARIA and some associated jargon:
ARIA (Accessible Rich Internet Applications)
ARIA is defined by the W3C (World Wide Web Consortium) and aims to make web content and applications more accessible. It is particularly useful for dynamic content and advanced user interface controls developed with JavaScript, HTML, and related technologies.
Key Concepts and Jargon
1. Roles
Roles define the type of element and its purpose. They tell assistive technologies what kind of element they are dealing with. Common ARIA roles include:
role="button"
: Indicates that an element should be treated as a button.role="alert"
: Indicates an element that provides an alert.role="dialog"
: Defines a dialog window.role="navigation"
: Indicates a navigation landmark.
2. Properties
Properties describe the state and behavior of an element. They provide additional information about an element’s behavior or state.
aria-labelledby
: Associates an element with the ID of another element that labels it.aria-describedby
: Associates an element with the ID of another element that describes it.aria-live
: Indicates that an element’s content is subject to change and should be read by screen readers (e.g.,aria-live="polite"
).
3. States
States are similar to properties but they change over time. They describe the current condition of an element.
aria-checked
: Indicates the current state of a checkbox or radio button (true
,false
,mixed
).aria-expanded
: Indicates whether an element, like a menu or accordion, is expanded or collapsed (true
orfalse
).aria-hidden
: Indicates whether an element is visible or hidden (true
orfalse
).
4. ARIA Landmarks
Landmarks are roles that help define regions of a page to assistive technologies, aiding navigation.
role="banner"
: Represents site-oriented content (typically the site’s logo or name).role="main"
: Represents the main content of a document.role="complementary"
: Represents a supporting section of the main content.
5. Live Regions
Live regions are parts of a web page that are subject to change and should be communicated to the user by screen readers.
aria-live
: Defines the politeness level of updates (off
,polite
,assertive
).
6. ARIA Labels
Labels and descriptions provide contextual information for user interface elements.
aria-label
: Provides a label for an element.aria-labelledby
: Links an element to another element that contains its label.aria-describedby
: Links an element to another element that contains its description.
Examples
Here are some practical examples of ARIA in use:
Example 1: Button Role
<div role="button" aria-pressed="false" tabindex="0">
Click me
</div>
role="button"
: Tells assistive technologies thisdiv
should be treated as a button.aria-pressed="false"
: Indicates the button is not pressed.tabindex="0"
: Makes the element focusable.
Example 2: Dialog Role
<div role="dialog" aria-labelledby="dialog-title" aria-describedby="dialog-description">
<h2 id="dialog-title">Dialog Title</h2>
<p id="dialog-description">This is a description of the dialog.</p>
<button>Close</button>
</div>
role="dialog"
: Defines the element as a dialog.aria-labelledby="dialog-title"
: Associates the dialog with its title.aria-describedby="dialog-description"
: Associates the dialog with its description.
Example 3: Live Region
<div aria-live="polite">
New messages will appear here.
</div>
aria-live="polite"
: Indicates that updates to this region should be announced to users politely (without interrupting).
Summary
ARIA attributes enhance the accessibility of web content by providing additional information to assistive technologies. Understanding and correctly implementing ARIA roles, properties, states, landmarks, live regions, and labels can significantly improve the user experience for people with disabilities. By making dynamic and interactive web content more accessible, ARIA helps create a more inclusive web.