aria-controls - Accessibility | MDN (2024)

The global aria-controls property identifies the element (or elements) whose contents or presence are controlled by the element on which this attribute is set.

Description

When an interactive widget or element, be it a combobox, tab, button, etc., is used to adjust or modify another element or component in a document or application, the aria-controls attribute can be used to programmatically associate the corresponding element or elements the controlling element. The aria-controls attribute identifies the element (or elements) whose contents or presence are controlled by the element on which the attribute is set, regardless of what type of interaction initiates the impacted behavior.

A combobox element has aria-controls set to a value that refers to the element that serves as the popup. The aria-controls only needs to be set when the popup is visible, but it is valid and easier to program to reference an element that is not visible.

Other examples of controls include:

  • The button parts of an accordion widget that toggle the visibility of their associated panel content. Each button may have an aria-controls specified, referencing the ID of the element containing the content associated with the invoking control.
  • An element with a role of scrollbar: the scrollbar requires an aria-controls attribute referencing the ID of the element it controls.
  • A group of tabs that each display a different tab panel: each element with role="tab" has an aria-controls attribute referencing its associated tabpanel.

Example

In this tabs example, each tab controls one tabpanel:

html

<div class="tab-interface"> <div role="tablist" aria-label="Sample Tabs"> <span role="tab" aria-selected="true" aria-controls="panel-1" id="tab-1" tabindex="0"> First Tab </span> <span role="tab" aria-selected="false" aria-controls="panel-2" id="tab-2" tabindex="-1"> Second Tab </span> <span role="tab" aria-selected="false" aria-controls="panel-3" id="tab-3" tabindex="-1"> Third Tab </span> </div> <div id="panel-1" role="tabpanel" tabindex="0" aria-labelledby="tab-1"> <p>Content for the first panel</p> </div> <div id="panel-2" role="tabpanel" tabindex="0" aria-labelledby="tab-2" class="display-none"> <p>Content for the second panel</p> </div> <div id="panel-3" role="tabpanel" tabindex="0" aria-labelledby="tab-3" class="display-none"> <p>Content for the third panel</p> </div></div>

Note: ARIA only modifies the accessibility tree for an element, identifying how assistive technology can present the content to users. ARIA doesn't change any implicit functionality or styling.

Values

id list

A space-separated list of one or more ID values referencing the elements being controlled by the current element

Associated interfaces

Element.ariaControlsElements

The ariaControlsElements property is part of each element's interface. Its value is a list of Elements corresponding to the ID values specified in the aria-controls attribute.

Associated roles

Used in ALL roles.

Specifications

Specification
Accessible Rich Internet Applications (WAI-ARIA)
# aria-controls

See also

aria-controls - Accessibility | MDN (2024)

FAQs

What are the valid values for aria-controls? ›

The only accepted values for the aria-current property are page, step, location, date, time, true and false. A non-null aria-current state on an element indicates that this element represents the current item within a container or set of related elements.

What is the aria role for accessibility? ›

ARIA roles provide semantic meaning to content, allowing screen readers and other tools to present and support interaction with an object in a way that is consistent with user expectations of that type of object.

What are aria-controls controlled by? ›

aria-controls

It identifies the element(s) that are controlled by the current element. The "aria-controls" element should be a "button" or a "link".

What is the common incorrect usage of aria attributes? ›

Web Accessibility – Common ARIA Mistakes to Avoid
  • Don't Use Unnecessary ARIA Labels. The first rule of ARIA is that you should not use ARIA unless you have to. ...
  • Don't Use the Wrong ARIA Attributes. ...
  • Know When to Use aria-labelledby. ...
  • Know When to Use aria-describedby. ...
  • Don't Use ARIA Child Roles Without Parent Roles.
Jan 11, 2023

Is aria an accessibility standard? ›

Accessible Rich Internet Applications ( ARIA ) is a set of roles and attributes that define ways to make web content and web applications (especially those developed with JavaScript) more accessible to people with disabilities.

How do you fix aria attributes must conform to valid values? ›

How to Fix the Problem. Ensure the value inside each attribute is spelled correctly and corresponds to a valid value. For example, aria-hidden="true" would pass, but aria-hidden="rtue" would fail, as would aria-hidden="pizza" .

Is Aria controls necessary? ›

The aria-controls only needs to be set when the popup is visible, but it is valid and easier to program to reference an element that is not visible.

What is a broken Aria reference accessibility? ›

What constitutes a broken ARIA reference? If Accessibility Checker flags a broken ARIA reference on your WordPress site, that means that an aria-labeledby or aria-describedby element is present on the page or post but that its reference target does not exist.

When accessibility best practices should be included in the project? ›

Accessibility is the responsibility of everyone involved in the project, including but not limited to the owner, designers, architects, engineers, builders, and contractors. Best practices to ensure compliance include identifying accessibility compliance as a key goal at the onset of a project.

How do you test aria-controls? ›

  1. Test Case: Use Insert + alt + M (Jump to controlled element) to navigate forward to `*[aria-controls]` Launch JAWS and Firefox. Navigate to the test page. Find the target element(s) that you will test against. Identify all elements that match this selector: *[aria-controls] ...
  2. Output: (navigated to controlled element)

What is the difference between aria-owns and controls? ›

Answer. The aria-controls property and the aria-owns property are both used when the relationship between elements cannot be determined from the DOM, but they each communicate a different type relationship. aria-controls identifies the element(s) whose contents are controlled by the current element.

What is the difference between aria-owns and aria-controls? ›

The difference between -owns and -controls is that -owns creates a parent/child relationship where none exists, and -controls indicates that one thing controls the other. So A can control B, but A doesn't have to be a parent of B for that to be the case.

What is aria hidden in HTML accessibility? ›

Adding aria-hidden="true" to an HTML element removes that element and all elements nested within it so that it is not visible or announced to users of assistive technology such as screen readers.

What is the first rule of aria? ›

The Rules of ARIA

First Rule of ARIA: Don't use ARIA. Well, actually, it says "if you can use a native HTML element or attribute... then do so." So, if you need a textbox, use an input, if you need a dropdown, use a select, if you need a button, use a button.

What is the aria hidden attribute? ›

It is an accessibility attribute that tells screen readers and other assistive technologies to ignore or hide the element from the user. When an element has aria-hidden="true" , it will not be presented to screen reader users.

What is the value aria-invalid? ›

Description. The aria-invalid attribute is used to indicate that the value entered into an input field is not in a format or a value the application will accept. This may include formats such as email addresses or telephone numbers.

What is aria button value? ›

The aria-pressed attribute is only relevant for toggle buttons. It represents the button's current "pressed" state. The value is "tri-state", meaning the value can be set to true , false , mixed , or undefined values. In the case of aria-pressed , like most tri-state value types, the default value is undefined .

What is the aria value in HTML? ›

aria-valuetext provides a way of presenting the current value in a more user-friendly, human-understandable way. For example, a battery meter value might be conveyed as aria-valuetext="8% (34 minutes) remaining" .

What are aria attributes for? ›

ARIA is shorthand for Accessible Rich Internet Applications. ARIA is a set of attributes you can add to HTML elements that define ways to make web content and applications accessible to users with disabilities who use assistive technologies (AT).

Top Articles
Latest Posts
Article information

Author: Rueben Jacobs

Last Updated:

Views: 6442

Rating: 4.7 / 5 (57 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Rueben Jacobs

Birthday: 1999-03-14

Address: 951 Caterina Walk, Schambergerside, CA 67667-0896

Phone: +6881806848632

Job: Internal Education Planner

Hobby: Candle making, Cabaret, Poi, Gambling, Rock climbing, Wood carving, Computer programming

Introduction: My name is Rueben Jacobs, I am a cooperative, beautiful, kind, comfortable, glamorous, open, magnificent person who loves writing and wants to share my knowledge and understanding with you.