repo_id
stringlengths 22
103
| file_path
stringlengths 41
147
| content
stringlengths 181
193k
| __index_level_0__
int64 0
0
|
---|---|---|---|
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-details/index.md | ---
title: aria-details
slug: Web/Accessibility/ARIA/Attributes/aria-details
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-details
---
The global `aria-details` attribute identifies the element (or elements) that provide additional information related to the object.
## Description
The `aria-details` attribute can be used to provide additional information or complex descriptions to an object. It is used to inform assistive technology users about the content by providing more in-depth information, whether that content is within the current document or a link to additional assets.
There are other HTML and WAI-ARIA properties that have similar purposes. The HTML {{HTMLElement('label')}} element and the [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) and [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) properties are used to provide short labels for an object. The HTML `title` attribute and the [`aria-description`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description) and [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) properties provide for longer plain text descriptions of an object. However, when additional information, complex descriptions, or navigable content related to the object is necessary and available, the `aria-details` attribute should be used.
The `aria-details` attribute serves a similar purpose as HTML's never fully-supported `longdesc` attribute - a URL of a long description to a replaced element's content - which was deprecated due to lack of support and misuse.
The `aria-details` attribute takes the [`id`](/en-US/docs/Web/HTML/Global_attributes#id), or space separated list of `id`s of the elements to get more detailed information as its values. When `aria-details` is included on an element, assistive technologies inform users of the availability of extended information, enabling the user to navigate to the referenced content.
Elements referenced by `aria-details` are intended to contain more information than would normally be provided via [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby).
The elements referenced by `aria-details` should be visible to all users. `aria-details` informs users that otherwise might not be able to scan a screen and discern quickly that the explanatory content is available.
> **Note:** `aria-details` has no impact on the accessible description.
Unlike `aria-describedby`, elements referenced by `aria-details` are not used in accessible descriptions and are not turned into a plain string when presented to assistive technology users. If the associated content is not too long and flattening the contents of the referenced element to a simple string of text wouldn't cause loss of information, consider using `aria-describedby` instead. That said, it is valid for an element to have both `aria-details` and a description specified with either `aria-describedby` or `aria-description`.
## Example
When it comes to definition and term roles, the `aria-details` would be included on the [`term`](/en-US/docs/Web/Accessibility/ARIA/Roles/term_role) element with the `id` of the element with a [`definition`](/en-US/docs/Web/Accessibility/ARIA/Roles/definition_role) role.
```html
<p>The <strong>cubic-bezier()<strong> functional notation defines a cubic
<span role="term" aria-details="bezier bezImg">Bézier curve</span>. As
these curves are continuous, they are often used to smooth down the start and
end of the curve and are therefore sometimes called easing functions.
</p>
<p role="definition" id="bezier">A <strong>Bézier curve</strong>,
(Pronounced \ ˈbe-zē-ˌā \)
<i aria-description="English pronunciation">BEH-zee-ay</i>) is a mathematically
described curve used in computer graphics and animation. The curve is defined
by a set of control points with a minimum of two. Web related graphics
and animations use Cubic Béziers, which are curves with four control
points P<sub>0</sub>, P<sub>1</sub>, P<sub>2</sub>, and P<sub>3</sub>.
</p>
<a href="bezierExplanation.html" id="bezImg"
aria-label="Explanation of Bézier curve in CSS easing functions">
<img alt="Animated Bézier curve showing 4 control points." src="bezier.gif">
</a>
```
## Values
- ID reference list
- : An `id` or space separated list of ids of elements that provide or link to additional related information.
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- HTML [id](/en-US/docs/Web/HTML/Global_attributes/id) attribute
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby)
- [`aria-description`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description)
- [The image `alt` attribute](/en-US/docs/Web/API/HTMLImageElement/alt)
- HTML [title](/en-US/docs/Web/HTML/Global_attributes/title) attribute
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-disabled/index.md | ---
title: aria-disabled
slug: Web/Accessibility/ARIA/Attributes/aria-disabled
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-disabled
---
The `aria-disabled` state indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
## Description
The `aria-disabled` attribute, when set to `true`, indicates that the element upon which it is set and all of its focusable descendants are meant to be in the disabled state. This declaration will inform people using assistive technologies, such as screen readers, that such elements are not meant to be editable or otherwise operable.
Unlike HTML's [`disabled`](/en-US/docs/Web/HTML/Element/input#disabled) Boolean attribute, which will communicate a form control as semantically being disabled, change its styling to reflect its state and suppress all functionality along with disallowing the element's value from participating in form submission, the `aria-disabled="true"` <strong>only</strong> semantically exposes these elements as being disabled. Web developers must manually ensure such elements have their functionality suppressed when exposed to the disabled state.
When needing to disable native HTML form controls, developers will need to specify the `disabled` attribute, as it provides all of the generally expected features of disabling a control by default. However, there can be instances where elements need to be exposed as disabled, but are still available for users to find when navigating via the <kbd>Tab</kbd> key. Doing so can improve their discoverability as they will not be removed from the focus order of the web page, as `aria-disabled` does not change the focusability of such elements, nor will the elements be dimmed by default browser styling, making them easier to read. Some examples of where this may be useful include:
- The header button element associated with non-collapsible accordion panel,
- A button which is important to keep in the page's focus order, but its action is presently unavailable - such as submitting a form,
- Temporarily inactive items in a menu widget that would otherwise be skipped over via standard keyboard navigation.
In each of these cases, one may want users to find these elements through standard keyboard navigation, though the functionality of that control is removed or "disabled". Developers will still need to use JavaScript to fully disable the functionality of the element while also changing the appearance of the element so sighted users know it is disabled.
> **Note:** The state of being disabled applies to the element with `aria-disabled="true"` and all of its focusable descendants. Take care when using this attribute on container elements. Particularly in the case where a container may have both form controls and links - where the intent may be to expose the form controls as being in the disabled state, but <strong>not</strong> to communicate the links as being "disabled".
Another reason to use the `aria-disabled` attribute over the HTML `disabled` attribute is if you have created custom controls which need to be marked as disabled, but are not using an element that allows for the `disabled` attribute. For instance, in the following snippet a `<div>` was used to create a custom button which needs to be marked as disabled. However, the `<div>` element does not expect, nor respect the `disabled` attribute - even if it were to be given a `role="button"` to change its exposed ARIA role. The `aria-disabled` attribute is required to disable such custom controls.
```html
<div role="button" aria-disabled="true" tabindex="-1">Edit</div>
```
Similarly to needing to use JavaScript to ensure an element with `aria-disabled="true"` is not functional, the element will also need styling adjustments. In contrast to the HTML `disabled` attribute, where specifying it provides `:disabled` user-agent styles to be applied, adding `aria-disabled="true"` doesn't. The element can be styled with the [attribute selector](/en-US/docs/Web/CSS/Attribute_selectors) `[aria-disabled="true"]`.
```css
[aria-disabled="true"] {
opacity: 0.5;
}
```
If you are purposefully using the `aria-disabled` attribute to allow for a form control to remain in the page's keyboard focus order, particularly if the element represents important content that all users should be able to perceive, then you may need to use styling that still passes color contrast requirements. For instance, a disabled button/heading that introduces a non-collapsible accordion panel is content that still needs to be legible.
```css
@media (forced-colors: active) {
[aria-disabled="true"] {
border-color: GrayText;
color: GrayText;
}
}
```
The [`forced-colors` media query](/en-US/docs/Web/CSS/@media/forced-colors) detects if the [user agent](/en-US/docs/Glossary/User_agent) has enabled a forced colors mode; if so, the text and border colors are both set to the [system color `greyText`](/en-US/docs/Web/CSS/system-color#syntax).
Another thing to keep in mind, when using `aria-disabled` over the native HTML attribute, is that the ARIA attribute will require the manual styling necessary to visually communicate the element as disabled in Windows High Contrast Mode.
> **Note:** If you are using CSS's [`pointer-events: none;`](/en-US/docs/Web/CSS/pointer-events) to make an element non-clickable, make sure you disable interactivity with JavaScript as well. `pointer-events: none;` prevents mouse clicks, but does not prevent the element from being activated via the keyboard.
```js
function onClick(event) {
event.preventDefault();
}
function toggleDisabled(element, status, update) {
if (status) {
//element.input.disabled = false;
element.setAttribute("aria-disabled", "false");
update.textContent = "The element is now enabled.";
element.addEventListener("click", onClick);
} else {
//element.input.disabled = true;
element.setAttribute("aria-disabled", "true");
update.textContent = "The element is now disabled.";
element.removeEventListener("click", onClick);
}
}
```
When toggling from `aria-disabled="true"` to `"false"`, use JavaScript to:
1. Toggle the value to `false` (or remove the attribute entirely),
2. Enable the element, and
3. Let the user know the control is now enabled.
If you used just CSS to style the disabled state using an attribute selector, the selector will no longer match and the disabled styling will no longer be in effect.
## Values
- `true`
- : The element is disabled
- `false`
- : The element is not disabled
## Associated interfaces
- {{domxref("Element.ariaDisabled")}}
- : The [`ariaDisabled`](/en-US/docs/Web/API/Element/ariaDisabled) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-disabled` attribute, which indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
- {{domxref("ElementInternals.ariaDisabled")}}
- : The [`ariaDisabled`](/en-US/docs/Web/API/ElementInternals/ariaDisabled) property of the {{domxref("ElementInternals")}} interface reflects the value of the `aria-disabled` attribute.
## Associated roles
Used in roles:
- [`application`](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role)
- [`button`](/en-US/docs/Web/Accessibility/ARIA/Roles/button_role)
- [`composite`](/en-US/docs/Web/Accessibility/ARIA/Roles/composite_role)
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`group`](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role)
- [`input`](/en-US/docs/Web/Accessibility/ARIA/Roles/input_role)
- [`link`](/en-US/docs/Web/Accessibility/ARIA/Roles/link_role)
- [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role)
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role)
- [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
Inherits into roles:
- [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role)
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role)
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`menu`](/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role)
- [`menubar`](/en-US/docs/Web/Accessibility/ARIA/Roles/menubar_role)
- [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role)
- [`menuitemradio`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role)
- [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role)
- [`radio`](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role)
- [`radiogroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/radiogroup_role)
- [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role)
- [`select`](/en-US/docs/Web/Accessibility/ARIA/Roles/select_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
- [`switch`](/en-US/docs/Web/Accessibility/ARIA/Roles/switch_role)
- [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role)
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
- [`toolbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/toolbar_role)
- [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role)
- [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
- [`treeitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/treeitem_role)
## Specifications
{{Specifications}}
## See also
- [Making disabled buttons more inclusive](https://css-tricks.com/making-disabled-buttons-more-inclusive/) by Sandrina Pereira
- [Styling for Windows high contrast with new standards for forced colors](https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/)
- [disabled](/en-US/docs/Web/HTML/Attributes/disabled)
- {{domxref("Element.ariaDisabled")}}
- {{domxref("ElementInternals.ariaDisabled")}}
- [`aria-hidden`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden)
- [`aria-readonly`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-haspopup/index.md | ---
title: aria-haspopup
slug: Web/Accessibility/ARIA/Attributes/aria-haspopup
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-haspopup
---
The `aria-haspopup` attribute indicates the availability and type of interactive popup element that can be triggered by the element on which the attribute is set.
## Description
In ARIA, interactive menus, listboxes, trees, grids, and dialogs that appear on top of other content when triggered to appear are considered "popups". These popups are triggered by one or more interactive elements on the page. The availability and type of popup the interactive element will trigger should be identified with the `aria-haspopup` state.
The presence of the `aria-haspopup`, with one of six enumerated values - `menu`, `listbox`, `tree`, `grid`, `dialog`, or `true` - indicates the element can trigger a popup and what kind of popup will be displayed. In turn, the element that pops up must be of the role indicated. The value `true` is the same as `menu`. Any other value, including an empty string or other [role](/en-US/docs/Web/Accessibility/ARIA/Roles), is treated as if `false` were set.
A [`tooltip`](/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role) is not considered to be a popup in this context, as it is not interactive.
> **Note:** Make sure the role of the element that serves as the container for the popup content is a [`menu`](/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role), [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role), [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role), [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role) or [`dialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role) and that the value of `aria-haspopup` matches the role of the popup container.
The `aria-haspopup` state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity. For the popup to be keyboard accessible, make sure the element with `aria-haspopup` is focusable and can trigger the popup, that there is a keyboard mechanism for opening the popup, and that the popup element manages focus of all its descendants.
> **Note:** ARIA does not enable accessible functionality. ARIA only conveys the intended behavior of your functionality.
When creating a [`menubar`](/en-US/docs/Web/Accessibility/ARIA/Roles/menubar_role), a parent [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role) should have `aria-haspopup="menu"` (or `true`) set. Any button that open a menu should have a role of [`button`](/en-US/docs/Web/Accessibility/ARIA/Roles/button_role) or, preferably, be a {{HTMLElement('button')}}, and also have `aria-haspopup="menu"` (or `true`) set. [`Tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) elements with popup menus should also have `aria-haspopup="menu"` set. Note that `menubar`s should not be used to create website navigation.
> **Note:** Elements with role [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role) have an implicit `aria-haspopup` value of `listbox`.
## Values
- `false` (default)
- : The element does not have a popup.
- `true`
- : The popup is a menu.
- `menu`
- : The popup is a menu.
- `listbox`
- : The popup is a listbox.
- `tree`
- : The popup is a tree.
- `grid`
- : The popup is a grid.
- `dialog`
- : The popup is a dialog.
## Associated interfaces
- {{domxref("Element.ariaHasPopup")}}
- : The [`ariaHasPopup`](/en-US/docs/Web/API/Element/ariaHasPopup) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-haspopup` attribute, which indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
- {{domxref("ElementInternals.ariaHasPopup")}}
- : The [`ariaHasPopup`](/en-US/docs/Web/API/ElementInternals/ariaHasPopup) property of the {{domxref("ElementInternals")}} interface reflects the value of the `aria-haspopup` attribute.
## Associated roles
Used in roles:
- [`application`](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role)
- [`button`](/en-US/docs/Web/Accessibility/ARIA/Roles/button_role)
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`link`](/en-US/docs/Web/Accessibility/ARIA/Roles/link_role)
- [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
- [`treeitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/treeitem_role)
Inherited into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role)
- [`menuitemradio`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role)
## Specifications
{{Specifications}}
## See also
- [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls)
- [`menu`](/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role)
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role)
- [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role)
- [`dialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role)
- [Toolbar example](https://www.w3.org/TR/2019/WD-wai-aria-practices-1.2-20191218/examples/toolbar/toolbar.html) - W3C WAI ARIA practices
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-valuemin/index.md | ---
title: aria-valuemin
slug: Web/Accessibility/ARIA/Attributes/aria-valuemin
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-valuemin
---
The `aria-valuemin` attribute defines the minimum allowed value for a range widget.
## Description
The `aria-valuemin` attribute defines the minimum value allowed for range widgets. It is similar to the `min` attribute of {{HTMLElement('progress')}}, {{HTMLElement('meter')}}, and {{HTMLElement('input')}} of type [`range`](/en-US/docs/Web/HTML/Element/input/range), [`number`](/en-US/docs/Web/HTML/Element/input/number) and all the date-time types.
When creating a range type role, including [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role), [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role), [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role), and [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role) on a non-semantic element, the `aria-valuemin` enables defining a minimum that is less than the maximum value and is a required attribute of `slider`, `scrollbar` and `spinbutton`.
Declaring the minimum and maximum values allows assistive technologies to convey the size of the range to users.
The maximum value is defined with [`aria-valuemax`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax).
> **Warning:** The [`range`](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role) role itself should **NOT** be used as it is an ["abstract"](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles). The `aria-valuemin` attribute is used on all of the range roles subtypes.
## Values
- `<number>`
- : A decimal number, below the maximum value.
## Associated interfaces
- {{domxref("Element.ariaValueMin")}}
- : The [`ariaValueMin`](/en-US/docs/Web/API/Element/ariaValueMin) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-valuemin` attribute.
- {{domxref("ElementInternals.ariaValueMin")}}
- : The [`ariaValueMin`](/en-US/docs/Web/API/ElementInternals/ariaValueMin) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-valuemin` attribute.
## Associated roles
Used in roles:
- [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role)
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
Inherited into roles:
- [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role)
- [`progressbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role)
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
## Specifications
{{Specifications}}
## See also
- [`range` role](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role)
- [`<input type="range>` element `min` attribute](/en-US/docs/Web/HTML/Element/input/range#min)
- [`aria-valuemax`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax)
- [`aria-aria-valuenow`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-aria-valuenow).
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-colindextext/index.md | ---
title: aria-colindextext
slug: Web/Accessibility/ARIA/Attributes/aria-colindextext
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-colindextext
---
The `aria-colindextext` attribute defines a human-readable text alternative of the numeric [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex).
## Description
When you have a very large table or when you purposefully want to display just a section of a table, not all columns may be present in the DOM. When this happens, we use the [`aria-colcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount) with an integer value to define how many columns the table (or grid) would have if all the columns were present and add the [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex) property on each column to provide information on the column index within that larger table.
In the following HTML snippet, our table has 8 columns, but we are only displaying 4. The "city" column is the fifth column of our larger table, as defined by `aria-colindex="5"`.
```html
<table aria-colcount="8">
<thead>
<tr>
<th aria-colindex="1" scope="col">First name</th>
<th aria-colindex="2" scope="col">Last name</th>
<th aria-colindex="5" scope="col">City</th>
<th aria-colindex="7" scope="col">Zip</th>
</tr>
</thead>
…
</table>
```
This table is not very complex. Had this been a 100+ column spreadsheet or a grid without column headers, such as a chess board, the provided or calculated value of `aria-colindex` might not be meaningful or may not reflect the displayed index. When this is the case, `aria-colindextext` can be included. The value is a string that is a human-readable text alternative to the numeric `aria-colindex`.
```html
<table aria-colcount="128">
<thead>
<tr>
<th aria-colindex="1" aria-colindextext="NYSE stock symbol" scope="col">
NYSE
</th>
<th
aria-colindex="110"
aria-colindextext="Value at start of 2021"
scope="col">
01/21
</th>
<th
aria-colindex="122"
aria-colindextext="Value at start of 2022"
scope="col">
01/22
</th>
<th aria-colindex="124" scope="col">Recommendation</th>
</tr>
</thead>
…
</table>
```
In the above example, the table has 128 columns of which only 4 columns are shown. The `aria-colindextext` is used in three columns to provide human-readable text alternatives. By including `aria-colindextext="Value at start of 2021"`, assistive technologies can announce "Value at start of 2021" instead of "Column 110".
Only use `aria-colindextext` when the provided or calculated value of `aria-colindex` is not meaningful or does not reflect the displayed index. Whenever you include `aria-colindextext`, also keep the `aria-colindex` as some assistive technologies rely on the numeric column index for the purpose of keeping track of the user's position and in providing alternative table navigation.
> **Note:** While `aria-colindex` can be added to a row when all the columns present are contiguous as sequential values can be deduced, `aria-colindextext` is NOT a supported property of [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role).
See related [`aria-rowindextext`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindextext).
## Values
- `<string>`
- The human-readable text alternative of the numeric [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex)
## Associated interfaces
- {{domxref("Element.ariaColIndexText")}}
- : The [`ariaColIndexText`](/en-US/docs/Web/API/Element/ariaColIndexText) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-colindextext` attribute.
- {{domxref("ElementInternals.ariaColIndexText")}}
- : The [`ariaColIndexText`](/en-US/docs/Web/API/ElementInternals/ariaColIndexText) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-colindextext` attribute.
## Associated roles
Used in roles:
- [`cell`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
Inherits into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
## Specifications
{{Specifications}}
## See also
- [`Element.ariaColIndexText`](/en-US/docs/Web/API/Element/ariaColIndexText)
- [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex)
- [`aria-rowindextext`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindextext)
- [`aria-colcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount)
- [`cell` role](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
- [`columnheader` role](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader` role](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-pressed/index.md | ---
title: aria-pressed
slug: Web/Accessibility/ARIA/Attributes/aria-pressed
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-pressed
---
The `aria-pressed` attribute indicates the current "pressed" state of a toggle button.
## Description
Adding `aria-pressed` to an element with a role of [`button`](/en-US/docs/Web/Accessibility/ARIA/Roles/button_role) turns the button into a toggle button. 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`.
Toggle buttons require a full press-and-release cycle to change their value. Pressing and releasing it once changes the value to `true`. If it's pressed and released again, the value changes back to `false`.
A value of `mixed` means that the values of more than one item controlled by the button do not all share the same value.
Do not change the contents of the label on a toggle when the state changes. If a button label says "pause", do not change it to "play" when pressed. In this example, when the pressed state is true, the label remains "Pause" so a screen reader would say something like "Pause toggle button pressed".
```html
<button aria-pressed="false">Pause</button>
```
If you want the label to toggle between "Paused" and "Play", don't use `aria-pressed`.
The first rule of ARIA use is "if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and adding an ARIA role, state or property to make it accessible, then do so." If we employ native HTML semantics with {{HTMLElement('button')}}, we can toggle the label instead of toggling the pressed state, removing the need for the `aria-pressed` attribute.
## Values
- `false`
- : The button supports being pressed but is not currently pressed.
- `mixed`
- : Indicates a mixed mode value for a tri-state toggle button.
- `true`
- : The button is pressed.
- `undefined` (default)
- : The element does not support being pressed.
## Associated interfaces
- {{domxref("Element.ariaPressed")}}
- : The [`ariaPressed`](/en-US/docs/Web/API/Element/ariaPressed) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-pressed` attribute.
- {{domxref("ElementInternals.ariaPressed")}}
- : The [`ariaPressed`](/en-US/docs/Web/API/ElementInternals/ariaPressed) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-pressed` attribute.
## Associated roles
Used in roles:
- [`button`](/en-US/docs/Web/Accessibility/ARIA/Roles/button_role)
## Specifications
{{Specifications}}
## See also
- [`<input type="button">`](/en-US/docs/Web/HTML/Element/input/button)
- [`<input type="submit">`](/en-US/docs/Web/HTML/Element/input/submit)
- {{HTMLElement('button')}}
- [`aria-checked`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked)
- [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-expanded/index.md | ---
title: aria-expanded
slug: Web/Accessibility/ARIA/Attributes/aria-expanded
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-expanded
---
The `aria-expanded` attribute is set on an element to indicate if a control is expanded or collapsed, and whether or not the controlled elements are displayed or hidden.
## Description
There are several widgets that can be expanded and collapsed, including menus, dialogs, and accordion panels. Each of these objects, in turn, has an interactive element that controls their opening and closing. The `aria-expanded` attribute is applied to this focusable, interactive control that toggles the visibility of the object.
For example, `aria-expanded` is applied to the parent item in a DOM tree to indicate whether its child branch is shown. The parent controls the visibility of the associated child branch, as well.
There are two declarations that can be applied to objects that control the visibility of another object: [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls), or [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns) combined with `aria-expanded`. The `aria-controls` and `aria-owns` indicate the relationship between the controlling element and the controlled element. The `aria-expanded` indicates to assistive technology whether the controlled element is expanded or collapsed.
Use the `aria-owns` property on the elements that own expandable grouping containers. If the expandable and collapsible grouping container is not owned by the element that has the `aria-expanded` attribute, use the `aria-controls` property to reference the grouping container instead.
### Buttons
A button that opens a widget should have `aria-controls` set to the [`id`](/en-US/docs/Web/HTML/Global_attributes#id) of the expandable widget and `aria-expanded` set to the current state of the widget.
```html
<button aria-expanded="false" aria-controls="widget1">Show widget</button>
```
When the widget is visible, the controlling object relays that information via having `aria-expanded="true"` set on it. The accessible name of the controlling object should reflect this change.
```html
<button aria-expanded="true" aria-controls="widget1">Hide widget</button>
```
### Menu
When a [`menu`](/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role) is displayed, the button object that toggles the visibility of that menu has `aria-expanded="true"` set. When the menu is hidden, aria-expanded can be omitted. If specified when the menu is hidden, it should be set as `aria-expanded="false"`. When a child menu is not visible, its parent [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role) has `aria-expanded`. It should be set to `true` when the child menu is visible.
### Combobox
By default, some roles are hidden or collapsed and other roles are open or expanded by default. Elements with role [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role) have a default value for `aria-expanded` of `false`. When a combobox popup is not visible, the element with role `combobox` has `aria-expanded` set to `false`. This is the default state. When the popup element is visible, `aria-expanded` should be set to `true`.
```html
<label for="username">Username</label>
<input id="username" name="username" aria-describedby="username-desc" />
<button
aria-expanded="false"
aria-controls="username-desc"
aria-label="Help about username"
type="button">
<span aria-hidden="true">?</span>
</button>
<p id="username-desc" hidden>
Your username is the name that you use to log in to this service.
</p>
```
> **Note:** The presence of the `aria-expanded` attribute indicates control. Avoid including it on elements that do not control the expanded state of other elements.
### Treeitems
Each element with role [`treeitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/treeitem_role) that serves as a parent node has `aria-expanded="false"` when the node is in a closed state and `aria-expanded="true"`when the node is in an open state. End nodes, nodes with no descendant nodes, should not have the `aria-expanded` attribute because, if they were to have it, they would be incorrectly described to assistive technologies as parent nodes.
### Rows
A parent row in a [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role) is a row that can be expanded or collapsed to show or hide a set of child rows in a table or grid. Each parent row has the `aria-expanded` state set on either the row element or on a cell contained in the row. When the child rows are hidden, `aria-expanded="false"` is set. `aria-expanded="true"` is set when the child rows are displayed. Rows that do not control the display of child rows should not include the `aria-expanded` attribute at all because including the attribute defines the rows as parent rows.
## Values
- `false`
- : The grouping element this element owns or controls is collapsed.
- `true`
- : The grouping element this element owns or controls is expanded.
- `undefined` (default)
- : The element does not own or control a grouping element that is expandable.
## Associated interfaces
- {{domxref("Element.ariaExpanded")}}
- : The [`ariaExpanded`](/en-US/docs/Web/API/Element/ariaExpanded) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-expanded` attribute.
- {{domxref("ElementInternals.ariaExpanded")}}
- : The [`ariaExpanded`](/en-US/docs/Web/API/Element/ariaExpanded) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-expanded` attribute.
## Associated roles
Used in roles:
- [`application`](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role)
- [`button`](/en-US/docs/Web/Accessibility/ARIA/Roles/button_role)
- [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role)
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`link`](/en-US/docs/Web/Accessibility/ARIA/Roles/link_role)
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role)
- [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
- [`treeitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/treeitem_role)
Inherits into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role)
- [`menuitemradio`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [`switch`](/en-US/docs/Web/Accessibility/ARIA/Roles/switch_role)
## Specifications
{{Specifications}}
## See also
- [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls)
- [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns)
- [`aria-hidden`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden)
- HTML [`hidden`](/en-US/docs/Web/HTML/Global_attributes#hidden) attribute
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-rowspan/index.md | ---
title: aria-rowspan
slug: Web/Accessibility/ARIA/Attributes/aria-rowspan
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-rowspan
---
The `aria-rowspan` attribute defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
## Description
Similar to the `rowspan` attribute of the {{HTMLElement('td')}} and {{HTMLElement('th')}} elements, but for cells and gridcells which are not contained in a native table, the `aria-rowspan` attribute defines the number of rows spanned by a `cell` or `gridcell` within a `table`, `grid`, or `treegrid`.
This attribute is intended for cells and gridcells which are **not** part of an HTML {{HTMLElement('table')}}. When a cell is nested in a semantic `<table>`, the `rowspan` attribute should be used when a <td> or <th> spans more than one row. If both are present, `rowspan` takes precedence over `aria-rowspan`. But, like all ARIA attributes, `aria-rowspan` only impacts the accessibility tree. It doesn't change your layout.
> **Note:** ARIA modifies the accessibility tree and how assistive technology presents content to your users. ARIA doesn't change anything about an element's function, behavior, or appearance. When using non-semantic elements, you must use CSS to manage layout and appearance.
The value of `aria-rowspan` is an integer greater than or equal to 0 and less than the value which would cause the cell or gridcell to overlap the next cell or gridcell in the same column. Setting the value to `0` indicates that the cell or gridcell is to span all the remaining rows in the row group. The default value is `1`.
## Values
- `<integer>`
- : An integer greater than or equal to `0` and less than would cause a cell to overlap the next cell in the same column.
## Associated interfaces
- {{domxref("Element.ariaRowSpan")}}
- : The [`ariaRowSpan`](/en-US/docs/Web/API/Element/ariaRowSpan) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-rowspan` attribute.
- {{domxref("ElementInternals.ariaRowSpan")}}
- : The [`ariaRowSpan`](/en-US/docs/Web/API/ElementInternals/ariaRowSpan) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-rowspan` attribute.
## Associated roles
Used in roles:
- [`cell`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
Inherited into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
## Specifications
{{Specifications}}
## See also
- The [`rowspan`](/en-US/docs/Web/HTML/Element/td#rowspan) attribute on {{HTMLElement('td')}}
- [`aria-rowindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex)
- [`aria-colspan`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colspan)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-multiline/index.md | ---
title: aria-multiline
slug: Web/Accessibility/ARIA/Attributes/aria-multiline
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-multiline
---
The `aria-multiline` attribute indicates whether a `textbox` accepts multiple lines of input or only a single line.
## Description
The default behavior of the <kbd>Enter</kbd> or <kbd>Return</kbd> key differs between single-line and multi-line text fields. When user focus is in a single-line `{{htmlelement("input/text", '<input type="text">')}}`, an <kbd>Enter</kbd> or <kbd>Return</kbd> keystroke usually submits the form.
When user focus is in a multi-line {{HTMLElement('textarea')}}, the keystroke inserts a line break. Only relevant for elements with the [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role) role set, the `aria-multiline` attribute indicates to assistive technologies whether that text box accepts multiple lines of input or only a single line, setting expectations as to what type of data to enter and what those keystroke will do.
> **Note:** Where possible, use the HTML {{HTMLElement('input')}} or the {{HTMLElement('textarea')}}, as these have built in semantics and behaviors, do not require ARIA attributes or scripting, and have keyboard support built in.
If the `aria-multiline="true"` is set, it means the textbox widget will accept line breaks within the input, similar to the HTML {{HTMLElement('textarea')}}. Elements with a role of `textbox` that do not have the attribute, or with the value set to `false`, are simple text box.
Be aware of focus and keystrokes when designing text boxes. ARIA only modifies the accessibility tree and therefore how assistive technology presents the textbox to your users. ARIA doesn't change anything about an element's default function or behavior. When not using semantic HTML elements for their intended purpose and default functionality, you must use JavaScript to manage behavior and functionality, including responding to keystroke events.
## Values
- `true`
- : The text box accepts multiple lines of input.
- `false`
- : The text box only accepts a single line of input.
## Associated interfaces
- {{domxref("Element.ariaMultiLine")}}
- : The [`ariaMultiLine`](/en-US/docs/Web/API/Element/ariaMultiLine) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-multiline` attribute.
- {{domxref("ElementInternals.ariaMultiLine")}}
- : The [`ariaMultiLine`](/en-US/docs/Web/API/ElementInternals/ariaMultiLine) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-multiline` attribute.
## Associated roles
Used in roles:
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
Inherits into roles:
- [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role)
## Specifications
{{Specifications}}
## See also
- ARIA [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role) role
- ARIA [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role) role
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-selected/index.md | ---
title: aria-selected
slug: Web/Accessibility/ARIA/Attributes/aria-selected
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-selected
---
The `aria-selected` attribute indicates the current "selected" state of various widgets.
## Description
The `aria-selected` attribute indicates the current "selected" state for [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role), [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role), [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role) and [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) roles.
This attribute is used to indicate which elements within single-selection and multiple-selection composite widgets are selected. If more than one element is selectable at a time, include `aria-multiselectable="true"` on the grid, listbox, tablist, or other owning role, while including `aria-selected` only on the selectable cells, options, and tabs.
For other roles, the currently selected state is set with [`aria-current`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current), or possibly [`aria-checked`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked) or [`aria-pressed`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed), depending on the role.
Widgets that support both `aria-selected` and `aria-current` at the same time have different meanings for each. For example, `aria-current="page"` can be used in a navigation tree to indicate which page is currently displayed, while `aria-selected="true"` indicates which page will be displayed if the user activates the `treeitem`.
### Grid
Setting `aria-selected="false"` on a focusable gridcell indicates the cell is selectable. If the grid allows more than one gridcell to be selected at a time, set `aria-multiselectable="true"` on the element with role [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role). Setting `aria-selected` on a column or row header gridcell does not propagate the state to other cells in the column or row.
### Option
Both `aria-selected` and `aria-checked` are valid for [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role). Some user interfaces indicate selection with `aria-selected` in single-select list boxes and with `aria-checked` in multi-select list boxes.
Don't specify both `aria-selected` and `aria-checked` on `option` elements contained by the same `listbox` unless the meaning and purpose of `aria-selected` is different from the meaning and purpose of aria-checked in the user interface, the meaning and purpose of each state apparent, and the UI provides separate methods for controlling each state.
### Row
The `aria-selected` attribute is supported on `row` but not `column`. If a grid supports selection, when a cell or row is selected, the selected element has `aria-selected="true"` set.
If the grid supports column selection and a column is selected, all cells in the column have `aria-selected` set to `true`.
### Tab
In a tablist, `aria-selected` is used on a tab to indicate the currently-displayed [`tabpanel`](/en-US/docs/Web/Accessibility/ARIA/Roles/tabpanel_role).
The selected [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) in a [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role) should have the attribute `aria-selected="true"` set. All inactive tabs in the tablist should have `aria-selected="false"` set. Setting the state only impacts the accessibility tree: make sure to style the active tab in a way that visual indicates it's selected state. The default value for `aria-selected` on a `tab` role is `false`.
If more than one tab is selectable at a time, include `aria-multiselectable` on the `tablist`.
## Examples
In this `tablist` example, the first `tab` is selected:
```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" hidden>
<p>Content for the second panel</p>
</div>
<div id="panel-3" role="tabpanel" tabindex="0" aria-labelledby="tab-3" hidden>
<p>Content for the third panel</p>
</div>
</div>
```
> **Note:** ARIA only modifies the accessibility tree for an element and how assistive technology presents the content to users. ARIA doesn't change anything about an element's function or behavior.
## Values
- `true`
- : The selectable element is selected.
- `false`
- : The selectable element is not selected. Implicit default for [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role).
- `undefined` (default)
- : The element is not selectable.
## Associated interfaces
- {{domxref("Element.ariaSelected")}}
- : The [`ariaSelected`](/en-US/docs/Web/API/Element/ariaSelected) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-selected` attribute.
- {{domxref("ElementInternals.ariaSelected")}}
- : The [`ariaSelected`](/en-US/docs/Web/API/ElementInternals/ariaSelected) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-selected` attribute.
## Associated roles
Used in roles:
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role)
- [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
Inherited into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [`treeitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/treeitem_role)
## Specifications
{{Specifications}}
## See also
- [`aria-pressed`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed)
- [`aria-checked`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-owns/index.md | ---
title: aria-owns
slug: Web/Accessibility/ARIA/Attributes/aria-owns
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-owns
---
The `aria-owns` attribute identifies an element (or elements) in order to define a visual, functional, or contextual relationship between a parent and its child elements when the DOM hierarchy cannot be used to represent the relationship.
## Description
Every element is the parent, sibling, or child of another element. The document object, made up of HTML elements and text nodes, is the basis of the DOM tree. The Accessibility Object Model (<abbr>AOM</abbr>) relies on a well-built DOM to enable assistive technologies to relay meaningful information about a document's contents to users.
There are circumstances where the layout that appears on screen may differ from the underlying DOM structure due to the ability of JavaScript to alter content and CSS to alter layout. When this is the case, the `aria-owns` attribute can be used to recreate a meaningful relationship for assistive technology that consumes the DOM.
When elements appear to be related visually but are not associated in the DOM, the `aria-owns` attribute enables creating the relationship that appears on screen in the accessibility layer for use by assistive technology. The **only** reason to include `aria-owns` is to expose a parent/child contextual relationship to assistive technology when the DOM's construction can't provide that relationship.
An "owning element" is any DOM ancestor of an element. If an element visually, functionally, or contextually appears to "own" (be an ancestor of) an element, but isn't actually an ancestor of the element in the DOM, include the `aria-owns` to create that relationship. Add the attribute to the owning element with reference to the non-child owned element (or elements) to tell assistive technology that an element should be treated as a child.
Referencing the ID of one or more elements allows any element to "own" any other element with an `aria-owns` declaration. The value of the `aria-owns` attribute is a space-separated ID reference list that references the IDs of one or more elements in the document.
> **Note:** An "owned" element is any DOM descendant of the element, any element specified as a child via `aria-owns`, or any DOM descendant of the owned child. The `aria-owns`-owned element should be an element that belongs to a separate parent tree in the DOM but should be treated as a child of the current element.
Do not use `aria-owns` as a replacement for the DOM hierarchy. If the relationship is represented in the DOM, do not use `aria-owns`.
A child element is owned by its DOM parent by default: in this case, `aria-owns` should not be used. Avoid using the `aria-owns` attribute to rearrange existing child elements into a different order.
When using `aria-owns`, make sure you [manage focus order](https://css-tricks.com/focus-management-and-inert/). Ensure the visual focus order matches this assistive technology reading order.
An example of when to use `aria-owns` includes pop-up sub-menus that visually appear positioned near a parent menu, but cannot be nested in the DOM within the parent menu because it would affect the visual presentation. In this case, use `aria-owns` to present the sub-menu as a child of the parent menu to a screen reader.
> **Note:** The `aria-owns` attribute should only be used when the parent/child relationship cannot be determined from the DOM.
If an element has both `aria-owns` and DOM children, the order of the child elements:
1. The actual DOM children first,
2. Then the elements referenced in `aria-owns`.
This order can be changed by including the ID references to the actual DOM children in the `aria-owns` value.
The {{CSSXRef('order')}} property, part of flex or grid layouts, can be used to change the order of flex and grid items making them appear in a different order from their order in the source document, creating a divergence of the logical order of elements. While it may be tempting to order the accessibility layer to match order changes created with the CSS {{CSSXref('order')}} property, avoiding both the `order` property and the `aria-owns` attribute is the best option.
Make sure your owned elements have only one owner. Do not specify the `id` of an element in more than one other element's `aria-owns` attribute. An element can have only one owner.
> **Warning:** At the time of this writing, [`aria-owns` is not supported](https://a11ysupport.io/tech/aria/aria-owns_attribute) on MacOS and iOS with VoiceOver.
## Values
- `id` list
- : Space separated list of one or more ID values referencing the elements being owned by the current element
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls)
- [`aria-owns` browser support](https://a11ysupport.io/tech/aria/aria-owns_attribute)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-level/index.md | ---
title: aria-level
slug: Web/Accessibility/ARIA/Attributes/aria-level
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-level
---
The `aria-level` attribute defines the hierarchical level of an element within a structure.
## Description
Levels of hierarchy appear in headings, trees, nested grid, nested tablists, and more. If the DOM ancestry does not accurately represent the level, the `aria-level` attribute should be used to define the hierarchical level elements within their hierarchical structures. Levels increase with depth. The value for aria-level is an integer greater than or equal to `1`.
When it comes to the headings in a document structure, you can have first-level headings, second-level headings, third-level headings, etc. In trees, you have the root element, its children, the children's children (or grandchildren), and so on.
The `aria-level` attribute exposes hierarchy to assistive technologies so it can be communicated to the users. Like all ARIA attributes, it has no impact on the user agent and therefore no impact on the user agent's determination of the document structure.
If the DOM ancestry accurately represents the level, the user agent can calculate the level of an item from the document structure, making `aria-level` not only redundant but a risk of creating misinformation. `aria-level` should really only be used to provide an explicit indication of level when it is not possible to calculate from the document structure. Test to see if this attribute is needed. If the user agent can calculate the level, it is best to omit the `aria-level` attribute.
### With `heading` role
The `aria-level` attribute is a required attribute of the [`heading`](/en-US/docs/Web/Accessibility/ARIA/Roles/heading_role) role which indicates to assistive technologies that the element should be treated as a heading. `<div role="heading" aria-level="1">` defines the `<div>` as being the main heading of the page. A level 2 heading, defined with `aria-level="2"` would be the first subsection, a level 3 is a subsection of that, and so on.
```html
<div role="heading" aria-level="3">Heading for this sub section</div>
```
Opt for using the {{htmlelement("Heading_Elements", "h1")}} through {{htmlelement("Heading_Elements", "h6")}} elements instead.
### Within `treegrid` role
In the case of a [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role), `aria-level` is supported on elements with the role [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role), not elements with role [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role). Rows act as leaf nodes within the vertical orientation of the grid. Gridcells are leaf nodes within the horizontal orientation of each row. `Aria-level` is not supported on cells within rows. So, in treegrids, the `aria-level` attribute is applied to the element with the role `row`.
If a complete set of available nodes is not present in the DOM due to dynamic loading as the user moves focus in or scrolls the tree, each node has `aria-level`, [`aria-setsize`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize), and [`aria-posinset`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset) included.
## Values
- `<integer>`
- : An integer greater than or equal to 1
## Associated interfaces
- {{domxref("Element.ariaLevel")}}
- : The [`ariaLevel`](/en-US/docs/Web/API/Element/ariaLevel) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-level` attribute.
- {{domxref("ElementInternals.ariaLevel")}}
- : The [`ariaLevel`](/en-US/docs/Web/API/ElementInternals/ariaLevel) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-level` attribute.
## Associated roles
Used in roles:
- [`associationlistitemkey`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`comment`](/en-US/docs/Web/Accessibility/ARIA/Roles/comment_role)
- [`heading`](/en-US/docs/Web/Accessibility/ARIA/Roles/heading_role)
- [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
## Specifications
{{Specifications}}
## See also
- [`<h1>` through `<h6>`: The HTML Section Heading elements](/en-US/docs/Web/HTML/Element/Heading_Elements) ({{htmlelement("Heading_Elements", "h1")}}, {{htmlelement("Heading_Elements", "h2")}}, {{htmlelement("Heading_Elements", "h3")}}, {{htmlelement("Heading_Elements", "h4")}}, {{htmlelement("Heading_Elements", "h5")}}, and {{htmlelement("Heading_Elements", "h6")}})
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-multiselectable/index.md | ---
title: aria-multiselectable
slug: Web/Accessibility/ARIA/Attributes/aria-multiselectable
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-multiselectable
---
The `aria-multiselectable` attribute indicates that the user may select more than one item from the current selectable descendants.
## Description
The default behavior of selection lists, such as {{HTMLElement('select')}}, is to be able to choose only one item or option. By default or by convention, when a user is presented with list from which they must select an item, they assume they can only select a single item unless otherwise notified. The `aria-multiselectable` attribute is the way to inform assistive technology users that they may select more than one item from the current selectable items if they so choose. Lists and trees are examples of roles that might allow users to select more than one item at a time.
> **Note:** When allowing for multiple selections, inform the user that multiple values are allowed and provide directions on how to provide multiple values, such as "to select more than one value, keep the control key pressed during selection."
### Used with `aria-selected`
When the user does select one or more items, remember to set the selected descendants as selected with [`aria-selected="true"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected), and selectable descendants that are not selected have `aria-selected="false"` set. If an element is not selectable, omit the `aria-selected` attribute altogether as its presence informs the user the item is selectable.
If a tree, grid, tab list, or list box supports selection of more than one node, the element with role [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role), [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role), [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role), or [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role) has `aria-multiselectable` set to `true`. Otherwise, `aria-multiselectable` is either set to `false` or the default value of false is implied.
## Example
```html
<p id="colorOptions">Choose the colors for your flag.</p>
<ul
tabindex="0"
role="listbox"
aria-labelledby="colorOptions"
aria-multiselectable="true">
<li id="red" role="option" aria-selected="false">Red</li>
<li id="orange" role="option" aria-selected="false">Orange</li>
<li id="yellow" role="option" aria-selected="false">Yellow</li>
<li id="green" role="option" aria-selected="false">Green</li>
<li id="blue" role="option" aria-selected="false">Blue</li>
<li id="purple" role="option" aria-selected="false">Purple</li>
<li id="magenta" role="option" aria-selected="false">Hot pink</li>
<li id="lightpink" role="option" aria-selected="true">Light pink</li>
<li id="white" role="option" aria-selected="true">White</li>
<li id="lightblue" role="option" aria-selected="true">Light blue</li>
<li id="black" role="option" aria-selected="false">Black</li>
<li id="brown" role="option" aria-selected="false">Brown</li>
</ul>
```
This listbox supports multiple selection so we set the element with role `listbox` with `aria-multiselectable="true"`. All selected options have `aria-selected` set to `true`. All options that are not selected but are selectable have `aria-selected` set to false. Had we included options that were disabled or otherwise not selectable, we would have omitted the `aria-selected` attribute altogether. Including the attribute, even with no value or explicitly set to `false` indicates to assistive technology users that the item is selectable.
The first rule of ARIA use is "if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and **adding** an ARIA role, state or property to make it accessible, then do so." Instead of creating an unordered list requiring [`tabindex`](/en-US/docs/Web/HTML/Global_attributes#tabindex), ARIA and JavaScript to turn text into selectable options, we could have used a native multiselect: the {{htmlelement('select')}} element has a Boolean [`multiple`](/en-US/docs/Web/HTML/Element/select#multiple) attribute. If included, the user can select multiple options. If not, only a single option can be selected.
```html
<label for="flagcolors"> Choose the colors for your flag. </label>
<select multiple id="flagcolors">
<option value="red">Red</option>
<option value="orange">Orange</option>
<option value="yellow">Yellow</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
<option value="purple">Purple</option>
<option value="magenta">Hot pink</option>
<option value="lightpink" selected>Light pink</option>
<option value="white" selected>White</option>
<option value="lightblue" selected>Light blue</option>
<option value="black">Black</option>
<option value="brown">Brown</option>
</select>
```
This HTML `<select>` version is accessible and interactive, and needs no ARIA or JavaScript to function.
If the above isn't stylable to your liking, you can also create a list of selectable options with HTML checkboxes, which is also semantic, focusable, and infinitely stylable with CSS:
```html
<fieldset>
<legend>Choose the colors for your flag.</legend>
<ul>
<li>
<label><input type="checkbox" name="fc" value="red" />Red</label>
</li>
<li>
<label><input type="checkbox" name="fc" value="orange" />Orange</label>
</li>
<li>
<label><input type="checkbox" name="fc" value="yellow" />Yellow</label>
</li>
<li>
<label><input type="checkbox" name="fc" value="green" />Green</label>
</li>
<li>
<label><input type="checkbox" name="fc" value="blue" />Blue</label>
</li>
<li>
<label><input type="checkbox" name="fc" value="purple" />Purple</label>
</li>
<li>
<label><input type="checkbox" name="fc" value="magenta" />Hot pink</label>
</li>
<li>
<label
><input type="checkbox" name="fc" value="lightpink" checked />Light
pink</label
>
</li>
<li>
<label
><input type="checkbox" name="fc" value="white" checked />White</label
>
</li>
<li>
<label
><input type="checkbox" name="fc" value="lightblue" checked />Light
blue</label
>
</li>
<li>
<label><input type="checkbox" name="fc" value="black" />Black</label>
</li>
<li>
<label><input type="checkbox" name="fc" value="brown" />Brown</label>
</li>
</ul>
</fieldset>
```
Instead of `aria-selected="true"`, include the [`checked`](/en-US/docs/Web/HTML/Element/input/checkbox#checked) attribute. The browser does the rest.
## Values
- `true`
- : More than one item in the widget may be selected at a time
- `false`
- : Only one item can be selected
## Associated interfaces
- {{domxref("Element.ariaMultiSelectable")}}
- : The [`ariaMultiSelectable`](/en-US/docs/Web/API/Element/ariaMultiSelectable) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-multiselectable` attribute.
- {{domxref("ElementInternals.ariaMultiSelectable")}}
- : The [`ariaMultiSelectable`](/en-US/docs/Web/API/ElementInternals/ariaMultiSelectable) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-multiselectable` attribute.
## Associated roles
Used in roles:
- [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role)
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role)
- [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role)
Inherited into roles:
- [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement('select')}} element
- HTML {{HTMLElement('option')}} element
- HTML {{HTMLElement('input')}} element
- [multiple](/en-US/docs/Web/HTML/Attributes/multiple) attribute
- [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-busy/index.md | ---
title: aria-busy
slug: Web/Accessibility/ARIA/Attributes/aria-busy
page-type: aria-attribute
spec-urls:
- https://w3c.github.io/aria/#aria-busy
- https://www.w3.org/TR/wai-aria-1.2/#aria-busy
---
Used in [ARIA live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions), the global `aria-busy` state indicates an element is being modified and that assistive technologies may want to wait until the changes are complete before informing the user about the update.
When multiple parts of a live region need to be loaded before changes are announced to the user, set `aria-busy="true"` until loading is complete. Then set to `aria-busy="false"`. This prevents assistive technologies from announcing changes before updates are done.
## Description
There is a section of content that updates. The updates are important and you want to let the user know when it has been modified, so you have converted it into an [ARIA live region](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) with the [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) attribute. You may want to update several components of that section at the same time, but you can't be sure that everything will update simultaneously. Even if it is a very important live region with `aria-live="assertive"`, you don't want to interrupt the user multiple times as different parts of the content load. This is where `aria-busy` can help.
The `aria-busy` property is an optional property of live regions that can have the value `true` or `false`. The `aria-busy` attribute with a value of `true` can be added to an element currently being updated or modified, to inform the assistive technology that it should wait until the modifications or changes are complete before exposing the content to the user. Use the [`ariaBusy`](/en-US/docs/Web/API/Element/ariaBusy) property of the object to change the value to `false` when downloading is complete.
```js
ariaLiveElement.ariaBusy = "false";
```
[`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live)'s value dictates whether the changes are announced immediately upon changing the value to `false`, or the assistive technology waits until the current task is complete before interrupting the user.
### Within a `feed`
If an element with [`feed`](/en-US/docs/Web/Accessibility/ARIA/Roles/feed_role) role has `aria-busy` set to `true`, the rendering changes that occur inside the feed will not be announced with the exception of user-initiated changes.
### Within a `widget`
If changes to a rendered widget would create a state where the widget is missing required owned elements during script execution, set `aria-busy` to `true` on the widget during the update process. For example, if a rendered tree grid updates multiple branches not necessarily rendered simultaneously, an alternative to replacing the whole tree in a single update would be to mark the tree busy while each of the branches is modified.
## Values
- false (default):
- : There are no expected updates for the element.
- true
- : The element is being updated.
## Associated interfaces
- {{domxref("Element.ariaBusy")}}
- : The [`ariaBusy`](/en-US/docs/Web/API/Element/ariaBusy) property, part of each element's interface, reflects the value of the `aria-busy` attribute, which indicates whether an element is being modified.
```html
<div
id="clock"
role="timer"
aria-live="polite"
aria-atomic="true"
aria-busy="false"></div>
```
```js
const el = document.getElementById("clock");
console.log(el.ariaBusy); // false
el.ariaBusy = "true";
console.log(el.ariaBusy); // true
```
## Associated roles
Used in **ALL** roles
## Specifications
{{Specifications}}
## See also
- [ARIA live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)
- [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live)
- [`aria-relevant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant)
- [`aria-atomic`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic)
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-live/index.md | ---
title: aria-live
slug: Web/Accessibility/ARIA/Attributes/aria-live
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-live
---
The global `aria-live` attribute indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
## Description
When content changes after initial load, assistive technology (AT) users may not "see" the changes. Some changes are important. Others are not. The `aria-live` attribute enables developers to inform the user of updates and choose, based on importance and urgency, whether to immediately, proactively, or passively inform AT users of changes to the content.
If a section of the screen updates, if it's styled in a way to be noticeable, most sighted users will generally notice live updates. Screen readers, on the other hand, only focus on one part of the page at a time; and that part may not be where the update is. The `aria-live` attribute provides a way for developers to announce such changes to AT based on event triggers set by the developer rather than by user initiated actions so they are made aware that the content has changed.
```html
<div id="announce" aria-live="polite"></div>
```
The `aria-live` attribute is set on an **empty** element. When an update to the page occurs, the empty element with that `aria-live` attribute should be updated with a brief announcement informing the user an update has been made.
```html
<div id="announce" aria-live="polite">
<p>This message is announced.</p>
</div>
```
When the accessibility API recognizes a change to the live region above, it will announce the contents of that live region based on the value of the attribute. The element is **not** given focus.
If you want all the contents of the live region to be read, use the [`aria-atomic`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic). Use [`aria-relevant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant) to define only the sections of an update that need to be reread to the user. Use [`aria-busy`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy) to prevent announcements while updates are still being made.
### Choosing the `aria-live` value
As some assistive technology users can't "see" live updates, the `aria-live` attribute is used to define what updated information the user should be:
- Made aware of immediately,
- Informed about if the opportunity avails itself, and
- Proactively informed about but can learn when they choose to focus on the updated area.
`aria-live`'s value describes the types of updates the user agents, assistive technologies, and user can expect from the live region, and is used to express degrees of importance.
When `aria-live`'s attribute is set to `polite`, assistive technologies will notify users of updates but generally do not interrupt the current task, with the updates having a low priority. When set to `assertive`, assistive technologies immediately notify the user, potentially clearing the speech queue of previous updates.
Screen readers buffer content when the page is loaded. Because of this, content added after the initial accessibility tree is built may not be noticed as AT users start consuming content before dynamic widgets are populated—users may not know about the page or view content updating as widgets finish loading. In this situation you can let users know the page has been updated by setting `aria-live="polite"`.
Fully populated pages may have updates too. Examples are content like real-time sports scores, news crawlers, and stock market tickers. Unless these kinds of updates are the main function of the page, you likely do not want to inform the user every time it updates, but do want to inform them the widget does get updated. Here, you would set `aria-live="off"`. In these scenarios there is no reason to inform the user of updates unless they are focused on the live region.
Some live updates are important and time sensitive. For example, if you are selling concert tickets and the user has a limited time to make the purchase, you don't want to wait until a lull in activity to tell them their time is almost up (or already over). When being informed as soon as possible is necessary, set `aria-live="assertive"`. If the updated information is an [`alert`](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role), the `aria-live` attribute is not needed.
In this time-limit scenario, to be accessible, you need to also [provide a way for users to extend the time available or turn the timer off completely](https://www.w3.org/WAI/WCAG21/Understanding/timing-adjustable.html).
### Using `aria-live`
A live region includes the element and all its descendants. When not set on updating content, `aria-live`'s value comes from the nearest ancestor with a valid `aria-live` attribute value set. When set to `off`, or when the attribute is omitted altogether on the updated element and all the ancestor nodes in the DOM tree, the user is not informed. Users will still be able to hear the updates if they navigate to the live region, however.
> **Warning:** Because an interruption may disorient users or cause them to not complete their current task, don't use the `assertive` value unless the interruption is imperative.
## Values
- `assertive`
- : Indicates that updates to the region have the highest priority and should be presented to the user immediately.
- `off` (default)
- : Indicates that updates to the region should **not** be presented to the user unless the user is currently focused on that region.
- `polite`
- : Indicates that updates to the region should be presented at the next graceful opportunity, such as at the end of speaking the current sentence or when the user pauses typing.
## Associated interfaces
- {{domxref("Element.ariaLive")}}
- : The [`ariaLive`](/en-US/docs/Web/API/Element/ariaLive) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-live` attribute.
- {{domxref("ElementInternals.aria-live")}}
- : The [`ariaLive`](/en-US/docs/Web/API/ElementInternals/ariaLive) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-live` attribute.
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- [`aria-atomic`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic)
- [`aria-relevant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant)
- [`aria-busy`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy)
- [`alert` role](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-valuenow/index.md | ---
title: aria-valuenow
slug: Web/Accessibility/ARIA/Attributes/aria-valuenow
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-valuenow
---
The `aria-valuenow` attribute defines the current value for a `range` widget.
## Description
The `aria-valuenow` attribute defines the current value for range widgets. It is similar to the `value` attribute of {{HTMLElement('progress')}}, {{HTMLElement('meter')}}, and {{HTMLElement('input')}} of type [`range`](/en-US/docs/Web/HTML/Element/input/range), [`number`](/en-US/docs/Web/HTML/Element/input/number) and all the date-time types.
When creating a range type role, including [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role), [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role), [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role), and [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role) on a non-semantic element, the `aria-valuenow` enables defining a current numeric value between the minimum and maximum values. The minimum and maximum values are defined with [`aria-valuemin`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin) and [`aria-valuemax`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax).
> **Warning:** The [`range`](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role) role itself should **NOT** be used as it is an ["abstract"](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles). The `aria-valuenow` attribute is used on all of the range roles subtypes.
```html
<p id="birthyearLabel">What year were you born?</p>
<div
role="spinbutton"
tabindex="-1"
aria-valuenow="1984"
aria-valuemin="1900"
aria-valuemax="2021"
aria-labelledby="birthyearLabel">
<span class="value"> 1984 </span>
<span role="button">
<span aria-hidden="true">+</span>
Increment year by 1
</span>
<span role="button">
<span aria-hidden="true">-</span>
Decrement year by 1
</span>
</div>
```
Use semantic HTML elements when you can:
```html
<label for="birthyear">What year were you born?</label>
<input type="number" id="birthyear" value="1984" min="1900" max="2021" />
```
If there is no known value, like when a progress bar is in an indeterminate state, don't set an `aria-valuenow` attribute.
When there is no `aria-valuenow` set, no information is implied about a current value.
When used with sliders and spinbuttons, assistive technologies announce the actual value to users.
When used with progressbar and scrollbar, assistive technologies announce the value to users as a percent. When `aria-valuemin` and `aria-valuemax` are both defined, the percent value is calculated as a position on the range. Otherwise, the actual value is announced as a percent.
When the value to be announced, either the actual value or the value as a percent, may not be clear to users, the [`aria-valuetext`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext) attribute should be used to provide a user-friendly representation of the value. When set, the valuetext string is announced instead of the valuenow numeric value. For example, if a slider represents the days of the week, so the day of the week's `aria-valuenow` is a number, the `aria-valuetext` property should be set to a string that makes the slider value understandable, such as "Monday".
## Examples
```html
<p id="temperatureLabel">Oven Temperature</p>
<div
role="meter"
id="temperature"
aria-valuenow="205"
aria-valuemin="70"
aria-valuemax="250"
aria-labelledby="temperatureLabel">
<div class="meter-color" aria-hidden="true"></div>
</div>
```
The first rule of ARIA use is "if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and **adding** an ARIA role, state or property to make it accessible, then do so."
```html
<label for="temperature">
Oven Temperature
</p>
<input type="range" id="temperature"
value="205" min="70" max="250" step="5"/>
</meter>
```
If we employ native HTML semantics with {{HTMLElement('input')}} we get styles and semantics for free.
## Values
- `<number>`
- : A decimal number, between the minimum and maximum values.
## Associated interfaces
- {{domxref("Element.ariaValueNow")}}
- : The [`ariaValueNow`](/en-US/docs/Web/API/Element/ariaValueNow) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-valuenow` attribute.
- {{domxref("ElementInternals.ariaValueNow")}}
- : The [`ariaValueNow`](/en-US/docs/Web/API/ElementInternals/ariaValueNow) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-valuenow` attribute.
## Associated roles
Used in roles:
- [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role)
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
Inherited into roles:
- [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role)
- [`progressbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role)
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
## Specifications
{{Specifications}}
## See also
- [`range` role](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role)
- [`<input type="range>` element `value` attribute](/en-US/docs/Web/HTML/Element/input/range#value)
- [`aria-valuetext`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext)
- [`aria-valuemax`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax)
- [`aria-valuemin`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin).
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-describedby/index.md | ---
title: aria-describedby
slug: Web/Accessibility/ARIA/Attributes/aria-describedby
page-type: aria-attribute
spec-urls:
- https://w3c.github.io/aria/#aria-describedby
- https://www.w3.org/TR/wai-aria-1.2/#aria-describedby
---
The global `aria-describedby` attribute identifies the element (or elements) that describes the element on which the attribute is set.
## Description
The `aria-describedby` attribute lists the [`id`](/en-US/docs/Web/HTML/Global_attributes#id)s of the elements that describe the object. It is used to establish a relationship between widgets or groups and the text that describes them.
The `aria-describedby` attribute is not limited to form controls. It can also be used to associate static text with widgets, groups of elements, regions that have a heading, definitions, and more. The `aria-describedby` attribute can be used with semantic HTML elements and with elements that have an ARIA [`role`](/en-US/docs/Web/Accessibility/ARIA/Roles).
The `aria-describedby` attribute is very similar to [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) attribute. While `aria-labelledby` lists the `id`s of the labels or elements that describe the essence of an object, `aria-describedby` lists the `id`s of the descriptions or elements providing more information that the user might need. Both `aria-labelledby` and `aria-describedby` reference other elements to calculate a text alternative, but a label should be concise, while a description is intended to provide more verbose information; a label describes the essence of an object, while a description provides more information that the user might need.
The elements linked via `aria-describedby` don't need to be visible. It is possible to reference an element even if that element is hidden. For example, a form control can have a description that is hidden by default that is revealed on request using a disclosure widget like a "more information" icon. The sighted user clicks on the icon; for assistive technology users the description is referenced from that form field directly with `aria-describedby`.
The `aria-describedby` property is appropriate when the associated content contains descriptions experienced as plain text. If the content contains a large amount of content, useful semantics, or has a complex structure requiring user navigation, use [`aria-details`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details). `aria-details` allows assistive technology users to visit the associated structured content and provides additional navigation commands, making it easier to understand the structure, or to experience the information in smaller pieces.
> **Note:** The `aria-describedby` content should only be a text string. If there are important underlying semantics in the content, consider using [`aria-details`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details).
## Example
```html
<button aria-describedby="trash-desc">Move to trash</button>
…
<p id="trash-desc">
Items in the trash will be permanently removed after 30 days.
</p>
```
> **Note:** The `aria-describedby` attribute is not designed to reference descriptions from external resources. As its value is one or more `id`s (space-separated if multiple), it must reference elements in the same DOM document.
## Values
- ID reference list
- : The `id` or space-separated list of element `id`s that describe the current element.
## Associated roles
Used in **all** roles. Usable in all HTML elements as well.
## Specifications
{{Specifications}}
## See also
- {{HTMLElement('label')}}
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- [`aria-description`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-description)
- [`aria-details`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details)
- [Browser and AT support for `aria-describedby`](https://a11ysupport.io/tech/aria/aria-describedby_attribute)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-errormessage/index.md | ---
title: aria-errormessage
slug: Web/Accessibility/ARIA/Attributes/aria-errormessage
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-errormessage
---
The `aria-errormessage` attribute on an object identifies the element that provides an error message for that object.
## Description
When there is a user-created error, you want to let them know it exists and tell them how to fix it. There are two attributes you need to use: set [`aria-invalid="true"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid) to define the object as being in an error state, then add the `aria-errormessage` attribute with the value being the `id` of the element containing the error message text for that object.
The `aria-errormessage` attribute should only be used when the value of an object is not valid; when [`aria-invalid`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid) is set to `true`. If the object is valid and you include the `aria-errormessage` attribute, make sure the element referenced is hidden, as the message it contains is not relevant.
When `aria-errormessage` is relevant, the element it references must be visible so users can see or hear the error message.
Often times, you will want the element with the error message to be an [ARIA live region](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions), such as when an error message is displayed to users after they have provided an invalid value. The error message should describe what is wrong and inform the user what is required to make the object valid. Adding the error message as an ARIA live region informs assistive technologies that the user may benefit from the error message content even if the error message wouldn't otherwise be conveyed to the user.
Include a visible error message and link the invalid object with the `aria-errormessage` attribute if the failure is visually apparent and an explicit description of the error is necessary.
## Example
We create some styles to:
1. Hide all error messages,
2. Make invalid objects appear invalid, and
3. Show error messages that are siblings coming after an invalid object.
We use `aria-invalid="true"` to identify invalid objects:
```css
.errormessage {
visibility: hidden;
}
[aria-invalid="true"] {
outline: 2px solid red;
}
[aria-invalid="true"] ~ .errormessage {
visibility: visible;
}
```
When an object is invalid, we use JavaScript to add `aria-invalid="true"`. The above CSS makes the `.errormessage` following an invalid object become visible.
```html
<p>
<label for="email">Email address:</label>
<input
type="email"
name="email"
id="email"
aria-invalid="true"
aria-errormessage="err1" />
<span id="err1" class="errormessage">Error: Enter a valid email address</span>
</p>
```
When we went from valid to invalid, the only JavaScript change for this example was an update to `aria-invalid` on the email input object. As the error message follows the input and becomes visible and available on the accessibility tree, we are able to keep our example simple. We could have also applied an [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) property or used a live region roles such as [`alert`](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role).
## Values
- `id` reference
- : The value of the `id` of the element containing the error message for the current element
## Associated roles
Used in roles:
- [`application`](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role)
- [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role)
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`radiogroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/radiogroup_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
- [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role)
Inherits from roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role)
- [`switch`](/en-US/docs/Web/Accessibility/ARIA/Roles/switch_role)
- [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
## Specifications
{{Specifications}}
## See also
- HTML [`invalid`](/en-US/docs/Web/HTML/Global_attributes#invalid) attribute
- CSS {{CSSxref(':invalid')}} pseudoclass
- [`aria-invalid`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid)
- [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby)
- [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-grabbed/index.md | ---
title: aria-grabbed
slug: Web/Accessibility/ARIA/Attributes/aria-grabbed
page-type: aria-attribute
status:
- deprecated
spec-urls: https://w3c.github.io/aria/#aria-grabbed
---
The `aria-grabbed` state indicates an element's "grabbed" state in a drag-and-drop operation. {{deprecated_inline}}
## Description
Text selections, images, and links can be dragged by default. Setting the global [`draggable="true"`](/en-US/docs/Web/HTML/Global_attributes/draggable) attribute, part of HTML5's [Drag and Drop API](/en-US/docs/Web/API/HTML_Drag_and_Drop_API), with a [`dragstart` event handler](/en-US/docs/Web/API/HTMLElement/dragstart_event), means any DOM node can be made draggable as well.
The `aria-grabbed` attribute was used to indicate if an element is in a "grabbed" state in a drag-and-drop operation with `aria-grabbed="true"` or if that the element is grabbable, but not currently grabbed with `aria-grabbed="false"`.
Setting `aria-grabbed="true"` indicated the element had been selected for dragging. Setting `aria-grabbed="false"` indicated that the element could be grabbed for a drag-and-drop operation, but is not currently grabbed.
When `aria-grabbed` is set to `true`, the [`aria-dropeffect`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-dropeffect) attribute of all potential drop targets should be updated with the type of function, or effect, will occur to the grabbed element when it is dropped. When no element is in a grabbed state, revert the `aria-dropeffect` attributes of all your drop targets.
The `aria-grabbed` property is expected to be replaced by a new feature in a future version of WAI-ARIA and is considered deprecated.
> **Note:** ARIA does not enable accessible functionality. ARIA only conveys the intended behavior of your functionality.
## Values
- `true`
- : The element has been selected for dragging.
- `false`
- : The element is not currently selected for dragging, but can be made available for dragging by setting the property to `true`.
- `undefined` (default)
- : The element does not support being dragged
## Associated roles
Used in **ALL** [roles](/en-US/docs/Web/Accessibility/ARIA/Roles)
## Specifications
{{Specifications}}
## See also
- [`aria-dropeffect`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-dropeffect)
- [HTML global `draggable` attribute](/en-US/docs/Web/HTML/Global_attributes/draggable)
- HTML [Drag and Drop API](/en-US/docs/Web/API/HTML_Drag_and_Drop_API)
- {{domxref('dataTransfer')}}
- {{domxref('DataTransfer.dropEffect')}}
- {{domxref("HTMLElement/dragstart_event", "dragstart")}}
- [Accessible Drag and Drop](https://dev.opera.com/articles/accessible-drag-and-drop/) by Gez Lemon
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-relevant/index.md | ---
title: aria-relevant
slug: Web/Accessibility/ARIA/Attributes/aria-relevant
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-relevant
---
Used in ARIA live regions, the global `aria-relevant` attribute indicates what notifications the user agent will trigger when the [accessibility tree](/en-US/docs/Glossary/Accessibility_tree) within a live region is modified.
## Description
[ARIA live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) are areas of a web page that are updated when user's attention may be elsewhere. When an update is outside of the user's keyboard focus, assistive technologies such as screen readers use a live region area to report updates to the user.
Examples of live regions include news marquees, stock tickers, chat windows, and score boards. These update without user interaction. Some updates are important for the user to know about. They're relevant. Others are not. The `aria-relevant` is used to describe what types of changes have occurred to an [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) region, and which are relevant and should be announced.
The value is a space-separated list of change types, including `additions`, `removals`, and `text`, with a shorthand `all` meaning all three.
When `aria-relevant` is not defined, the value is inherited from the nearest ancestor with a defined value. Inherited values are not additive; the value provided on a descendant element completely overrides any inherited value from an ancestor element. When a live region doesn't have an `aria-relevant` attribute set and has no ancestor with it set, it defaults to `additions text`, because generally text modifications and node additions are relevant, but node removals are not.
While not a supported value, if the value of `none` makes the most sense, it should not be a live region.
The values of `removals` and `all` should be used sparingly. For example, when a goal happens in the World Cup, the new score (the addition) is important, the old value (the removal) is not. Assistive technologies only need to be informed of content removal when its removal represents an important change, such as a when a player is taken out of the game.
## Values
- `additions`
- : Element nodes are added to the accessibility tree within the live region.
- `all`
- : Shorthand for `additions removals text`.
- `removals`
- : Text content, a text alternative, or an element node within the live region is removed from the accessibility tree.
- `text`
- : Text content or a text alternative is added to any descendant in the accessibility tree of the live region.
- `additions text` (default)
- : Element nodes are added to the accessibility tree within the live region AND text content or a text alternative is added to any descendant in the accessibility tree of the live region.
## Associated interfaces
- {{domxref("Element.ariaRelevant")}}
- : The [`ariaRelevant`](/en-US/docs/Web/API/Element/ariaRelevant) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-relevant` attribute.
- {{domxref("ElementInternals.ariaRelevant")}}
- : The [`ariaRelevant`](/en-US/docs/Web/API/ElementInternals/ariaRelevant) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-relevant` attribute.
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- [`aria-atomic`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic)
- [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live)
- [`aria-busy`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy)
- [ARIA live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-keyshortcuts/index.md | ---
title: aria-keyshortcuts
slug: Web/Accessibility/ARIA/Attributes/aria-keyshortcuts
page-type: aria-attribute
spec-urls:
- https://w3c.github.io/aria/#aria-keyshortcuts
- https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/
---
The global `aria-keyshortcuts` attribute indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
## Description
A keyboard shortcut is a series of one or several keys that tells software to perform a pre-programmed action. Keyboard shortcuts enable keyboard users to invoke commands using the keyboard that would otherwise require accessing a menu or using touch or a mouse. The `aria-keyshortcuts` property defines the keyboard keys that have been implemented to activate or give focus to the element on which the attribute is set.
The `aria-keyshortcuts` attribute exposes the existence of the shortcut to assistive technologies so the presence of the shortcut can be communicated to its users. Like all ARIA attributes, it has no effect on the functionality of the page; the keyboard behavior must be added via JavaScript event handlers.
Keyboard shortcuts applied to disabled elements should also be disabled. For example, when disabling an element for mouse users, remember to disable it for keyboard shortcut users.
Ensure all keyboard shortcuts are both visible to sighted users and made available to assistive technology. If your application is complex enough to need keyboard shortcuts, also known as "hot keys", include a guided tour of your application, an accessibility page documenting shortcuts and other accessibility features, a shortcut cheat sheet page or dialog pop up, or other method of making the availability of keyboard short cuts known. In addition, show the shortcut in menus and tooltips.
### Property value rules
The value of the `aria-keyshortcuts` attribute is a space-separated list of key combinations that can be pressed to activate a command or textbox widget. Each key combination includes zero, one or more modifier keys followed by exactly one non-modifier key to be pressed at the same time joined with a plus sign ("+"). The attribute value is case-insensitive.
Examples of valid keyboard shortcuts include:
```plain
aria-keyshortcuts="A"
aria-keyshortcuts="Shift+Space"
aria-keyshortcuts="Control+Alt+."
aria-keyshortcuts="Control+Shift+'"
aria-keyshortcuts="alt+shift+p control+f"
aria-keyshortcuts="Meta+C Meta+Shift+C"
```
Modifier keys are keys that don't have any impact when used on their own. They are written as "Alt", "Control", "Shift", "Meta" (Command key on Mac), or "AltGraph" (Option key on Mac).
Non-modifier keys are keys that have impact when used alone, be that printing a character, moving focus, or otherwise creating a keyboard event when used. Non-modifiers that print a single character include characters like `P`, `z` and `.`.
Since the plus sign is used in writing key combinations, it is written as `plus` if used as the non-modifier. Other written-out non-modifiers include white space characters `Space`, `Tab`, and `Enter`, and all characters that result in actions, like `ArrowUp`, `PageUp`, and `Escape`.
If you want to use a character that might cause problems, like a double quote character within double quotes, escape the character: `Control+'`.
Modifier keys must be listed first in each key combination. Possible key combinations include `Control+P` or `Shift+Space` and `Q`. If the full shortcut requires all three of these combinations in order, it would be written as `aria-keyshortcuts="Control+P Shift+Space Q"`. When a key combination includes more than one modifier key, the order of the modifiers doesn't matter, but they all must come first, before the non-modifier.
These two attribute declarations are equivalent.
```plain example-good
aria-keyshortcuts="Shift+Control+V"
aria-keyshortcuts="control+shift+v"
```
Note that text case doesn't matter. But order of non-modifier does.
These two attribute declarations are invalid because the non-modifier must be last.
```plain example-bad
aria-keyshortcuts="V+Shift+Control"
aria-keyshortcuts="V+Control+Shift"
```
The key combination listed must be the keys the user needs to press, not the outcome of the combined key strokes. For example, on a USA keyboard, if you need the `@` symbol, the key combination is written as `"Shift+2"`, not `"@"` nor `"Shift+@"`.
### Best practices
In trying to improve the accessibility of your sites and applications, there are some best practices to follow to ensure your "enhancements" don't negatively impact user experience. Remember, no ARIA is better than bad ARIA.
#### Don't override browser, assistive technology, or operating system shortcuts
When implementing keyboard shortcuts, make sure you don't create shortcuts that are already being used by the browser, assistive technology, or operating system, unless they are used for the same thing. For example, `"Control+P"` is used by most user-agents to initiate print functionality. Generally a web application should not create a "Control+P" shortcut as it will usurp browser functionality. There are exceptions. Web applications where printing is common, like email applications or document editors, usurping the browser's `"Control+P"` printing functionality for an application specific print flow would be expected.
Unless you're creating an HTML version of a productivity application, you should likely avoid implementing keyboard shortcut. While overriding an operating system or browser keyboard shortcut can be annoying for non-assistive technology users, if you override a screen reader's keyboard functionality you can completely shut down access for the assistive technology user. If you must create keyboard shortcuts, avoid single letter keyboard shortcuts and common screen reader keyboard shortcuts.
#### Consider language and keyboard differences
Take into account the diversity of available keyboards and the various keyboard language preferences. Modifier keys are often used to create language specific common punctuation symbols and number characters. For example, numbers, when the keyboard language preference is set to French (France), use the Shift key.
#### Don't use HTML instead
The `aria-keyshortcuts` attribute is very similar to the [problematic](https://webaim.org/techniques/keyboard/accesskey#spec) HTML [`accesskey`](/en-US/docs/Web/HTML/Global_attributes#accesskey), which generates a keyboard shortcut for the current element. When an `accesskey` is defined for an element, the browser defines the modifiers and does all the work of handling the shortcut with no scripting required. Every browser and operating system combination has their own modifier keys for the non-modifier set in the `accesskey` attribute. What may work for one combination of operating system, assistive technology, and browser may not work with other combinations. With `aria-keyshortcuts`, the modifier keys are included in the attribute value list of key combinations and the functionality has to be scripted in.
```html
<p>
Press the
<strong><u>S</u></strong
>tress reliever to relax!
</p>
<button accesskey="s">Stress reliever</button>
```
In this example, we ensured the presence of the shortcut was known to sighted users a well by highlighting the non-modifier character.
While the goal of the `accesskey` attribute matches the intention of `aria-keyshortcuts` and to do so natively, `accesskey` is rife with issues. Because of these issues, it is generally advised not to use accesskeys for most general-purpose websites and web apps.
In addition to poor browser support, the same concerns arise for `accesskey` as exist for `aria-keyshortcuts`:
- An accesskey value can conflict with a system or browser keyboard shortcut, or assistive technology functionality.
- Certain key values may not be present on certain keyboards, especially when internationalization is a concern. So adapting to specific languages could cause further problems.
- Values that rely on numbers may be confusing to individuals experiencing cognitive concerns, where the number doesn't have a logical association with the functionality it triggers.
- Informing the user that shortcuts are present, so that they are aware of the functionality. If the system lacks a method of notifying the user about this feature, the user might accidentally activate a shortcut.
## Values
- `<string>`
- : The space-separated list of key combinations that, when pressed, perform the action.
## Example
In this example, the `aria-keyshortcuts` attribute on the element is set to "Alt+Shift+A".
```html
<a href="#content" aria-keyshortcuts="Alt+Shift+A">Skip to content</a>
```
## Associated interfaces
- {{domxref("Element.ariaKeyShortcuts")}}
- : The [`ariaKeyShortcuts`](/en-US/docs/Web/API/Element/ariaKeyShortcuts) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-keyshortcuts` attribute.
- {{domxref("ElementInternals.ariaKeyShortcuts")}}
- : The [`ariaKeyShortcuts`](/en-US/docs/Web/API/ElementInternals/ariaKeyShortcuts) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-keyshortcuts` attribute.
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- [`aria-keyshortcuts` best practices](https://www.w3.org/TR/wai-aria-practices-1.2/#kbd_shortcuts)
- HTML [`accesskey`](/en-US/docs/Web/HTML/Global_attributes#accesskey) attribute
- [Issues with `accesskey`](https://webaim.org/techniques/keyboard/accesskey#spec)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-invalid/index.md | ---
title: aria-invalid
slug: Web/Accessibility/ARIA/Attributes/aria-invalid
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-invalid
---
The `aria-invalid` state indicates the entered value does not conform to the format expected by the application.
## 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. `aria-invalid` can also be used to indicate that a required field is empty.
The `aria-invalid` attribute can be used with any typical HTML form element, and is not limited to elements that have an ARIA role assigned.
The attribute should be set with JavaScript as a result of a validation process. If a value is determined to be invalid or out-of-range, set `aria-invalid="true"` **and** tell the user there is an error. For better user experience, provide suggestions for how the error can be corrected. Do not set `aria-invalid="true"` on empty required elements until after the user attempts to submit the form. They may still be working on filling it out.
> **Note:** When `aria-invalid` is used in conjunction with the `aria-required` attribute, `aria-invalid` should not be set to true before the form is submitted - only in response to validation.
There are currently four values: in addition to `true` and `false` we have `grammar` which can be used when a grammatical error is detected and `spelling` for spelling errors. If the attribute is not present, or its value is false, or its value is an empty string, the default value of false applies. Any other value is treated as if `true` were set.
### Native HTML validation
HTML has native form validation. When a user submits a form with a control containing errors, the first form control with an invalid value displays an error message, natively.
If there is a [`required`](/en-US/docs/Web/HTML/Global_attributes#required) attribute on a form control that isn't filled out, the form will not submit, and an error message appears reading "Please fill out this field" or something similar. The messaging for native validation varies depending on the browser, and cannot be styled.
```html
<input type="number" step="2" min="0" max="100" required />
```
If the user had entered a value in the preceding input example above the maximum, below the minimum, or that doesn't match the step value, an error message would appear. If the user had entered "3", the native error message would be similar to "Please enter a valid value."
If you are creating your own form validation scripts, make sure to include `aria-invalid` on invalid form controls, along with styling (use the `[aria-invalid="true"]` attribute selector) and messaging (with [`aria-errormessage`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage)) to help users understand where the mistake is and how they can fix it.
## Values
- `grammar`
- : A grammatical error was detected.
- `false` (default)
- : There are no detected errors in the value.
- `spelling`
- : A spelling error was detected.
- `true`
- : The value entered by the user has failed validation.
Any value not in this list will be treated as `true`.
## Example
The following snippet shows a simplified version of two form fields with a validation function attached to the blur event. Note that since the default value for `aria-invalid` is `false`, it is not strictly necessary to add the attribute to input.
```html
<ul>
<li>
<label for="name">Full Name</label>
<input
type="text"
name="name"
id="name"
aria-required="true"
aria-invalid="false"
onblur="checkValidity('name', ' ', 'Invalid name entered (requires both first and last name)');" />
</li>
<li>
<label for="email">Email Address</label>
<input
type="email"
name="email"
id="email"
aria-required="true"
aria-invalid="false"
onblur="checkValidity('email', '@', 'Invalid email address');" />
</li>
</ul>
```
Note that it is not necessary to validate the fields immediately on blur; the application could wait until the form is submitted (though this is not necessarily recommended).
The snippet below shows a very simple validation function, which only checks for the presence of a particular character (in the real world, validation will likely be more sophisticated):
```js
function checkValidity(id, searchTerm, msg) {
const elem = document.getElementById(id);
if (elem.value.includes(searchTerm)) {
elem.setAttribute("aria-invalid", "false");
updateAlert();
} else {
elem.setAttribute("aria-invalid", "true");
updateAlert(msg);
}
}
```
The snippet below shows the alert functions, which add (or remove) the error message:
```js
function updateAlert(msg) {
const oldAlert = document.getElementById("alert");
if (oldAlert) {
oldAlert.remove();
}
if (msg) {
const newAlert = document.createElement("div");
newAlert.setAttribute("role", "alert");
newAlert.setAttribute("id", "alert");
const content = document.createTextNode(msg);
newAlert.appendChild(content);
document.body.appendChild(newAlert);
}
}
```
Note that the alert has the ARIA role attribute set to [`alert`](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role).
## Associated roles
Used in roles:
- [`application`](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role)
- [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role)
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`radiogroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/radiogroup_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
- [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role)
Inherited into role:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role)
- [`switch`](/en-US/docs/Web/Accessibility/ARIA/Roles/switch_role)
- [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
## Specifications
{{Specifications}}
## See also
- [`aria-errormessage`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage)
- CSS {{CSSXRef(':valid')}} pseudoclass
- CSS {{CSSXRef(':invalid')}} pseudoclass
- [Form Validation](/en-US/docs/Learn/Forms/Form_validation) tutorial
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-dropeffect/index.md | ---
title: aria-dropeffect
slug: Web/Accessibility/ARIA/Attributes/aria-dropeffect
page-type: aria-attribute
status:
- deprecated
spec-urls: https://w3c.github.io/aria/#aria-dropeffect
---
The global `aria-dropeffect` attribute indicates what functions may be performed when a dragged object is released on the drop target. {{deprecated_inline}}
## Description
Deprecated in ARIA 1.1, the `aria-dropeffect` property indicates what functions may be performed when a dragged object is released on the drop target. The global `aria-dropeffect` attribute provides assistive technology users the same information provided via the [`DataTransfer.dropEffect`](/en-US/docs/Web/API/DataTransfer/dropEffect) to sited users via the dropeffect icon.
Text selections, images, and links can be dragged by default. Setting the global [`draggable="true"`](/en-US/docs/Web/HTML/Global_attributes/draggable) attribute, part of HTML5's [Drag and Drop API](/en-US/docs/Web/API/HTML_Drag_and_Drop_API), with a [`dragstart` event handler](/en-US/docs/Web/API/HTMLElement/dragstart_event), means any DOM node can be made draggable as well.
When a drag event occurs, a translucent image is generated of the dragged element which follows the user's pointer during the drag. The default image can be changed to any image with [`setDragImage`](/en-US/docs/Web/API/DataTransfer/setDragImage). Along with the default image identifying the element being dragged, there is a [`dataTransfer.dropEffect`](/en-US/docs/Web/API/DataTransfer/dropEffect) property that can be used to control the visual feedback the user is given during a drag-and-drop operation. The `aria-dropeffect` property should be used to provide assistive technology users the same feedback provided to sited users via `dataTransfer.dropEffect` property.
`dropeffect` defines which cursor the browser displays while dragging, and is set on the element on which the element may be dropped. During the drag operation, as the draggable element is dragged over different drop areas, the drag effects—both the `dataTransfer.dropeffect` and the `aria-dropeffect` should be modified to indicate the type of operation that will occur if the dragged element is released.
More than one drop effect may be supported for a given element. Therefore, the value of the `aria-dropeffect` attribute is a space separated list of functions. Functions include `copy`, `execute`, `link`, and `move`. The default is `none`, meaning there is no supported functionality in the application. Setting `aria-dropeffect="popup"` informs assistive technology users that there is a popup menu or dialog of drag operations from which the user can choose.
Including the attribute provides assistive technologies the ability to convey the possible drag options available to the assistive technology user, but doesn't add any actual functionality.
The `aria-dropeffect` property is expected to be replaced by a new feature in a future version of WAI-ARIA and is considered deprecated.
Typically, drop effect functions can only be provided once an object has been grabbed for a drag operation, as the drop effect functions available are dependent on the object being dragged. Therefore, you'll generally add `aria-dropeffect` to all the potential drop targets when the {{domxref("HTMLElement/dragstart_event", "dragstart")}} event is fired.
## Values
The value is a space separated list of possible actions. The following are the valid tokens:
- `copy`
- : A duplicate of the source object will be dropped into the target.
- `execute`
- : A function supported by the drop target is executed, using the drag source as an input.
- `link`
- : A reference or shortcut to the dragged object will be created in the target object.
- `move`
- : The source object will be removed from its current location and dropped into the target.
- `none` (default)
- : No operation can be performed; effectively cancels the drag operation if an attempt is made to drop on this object. Ignored if combined with any other token value; for example, 'none copy' is equivalent to a 'copy' value.
- `popup`
- : There is a popup menu or dialog that allows the user to choose one of the drag operations (copy, move, link, execute) and any other drag functionality, such as cancel.
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- [`aria-grabbed`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-grabbed)
- [HTML global `draggable` attribute](/en-US/docs/Web/HTML/Global_attributes/draggable)
- HTML [Drag and Drop API](/en-US/docs/Web/API/HTML_Drag_and_Drop_API)
- {{domxref('dataTransfer')}}
- {{domxref('DataTransfer.dropEffect')}}
- {{domxref("HTMLElement/dragstart_event", "dragstart")}}
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-controls/index.md | ---
title: aria-controls
slug: Web/Accessibility/ARIA/Attributes/aria-controls
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-controls
---
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](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role) 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`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role): 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"`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) has an `aria-controls` attribute referencing its associated [`tabpanel`](/en-US/docs/Web/Accessibility/ARIA/Roles/tabpanel_role).
## 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
- {{domxref("Element.ariaBusy")}}
- : The [`ariaControls`](/en-US/docs/Web/API/Element/ariaBusy) property, part of each element's interface, reflects the value of the `aria-controls` attribute, which indicates whether an element is being modified.
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns)
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-labelledby/index.md | ---
title: aria-labelledby
slug: Web/Accessibility/ARIA/Attributes/aria-labelledby
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-labelledby
---
The `aria-labelledby` attribute identifies the element (or elements) that labels the element it is applied to.
## Description
The `aria-labelledby` property enables authors to reference other elements on the page to define an accessible name. This is useful when using elements that don't have native support for associating elements to provide an accessible name.
Some elements get their [accessible name](https://w3c.github.io/accname/#dfn-accessible-name) from their inner content. For example, the accessible name for a {{HTMLElement('button')}}, {{HTMLElement('a')}}, or {{HTMLElement('td')}} comes from the text between the opening and closing tags. Other elements, such as form {{HTMLElement('textarea')}}, {{HTMLElement('fieldset')}}, and {{HTMLElement('table')}} get their accessible name from the content of associated elements; for these elements, the accessible name comes from the {{HTMLElement('label')}} with a `for` attribute, {{HTMLElement('legend')}}, and {{HTMLElement('caption')}} respectively.
All interactive elements must have an accessible name. `aria-labelledby` can be used to reference another element to define its accessible name, when an element's accessible name needs to use content from elsewhere in the DOM.
If there is no content that can be referenced to create an accessible name, the [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) attribute should be used instead.
The purpose of `aria-labelledby` is the same as that of `aria-label`. It provides the user with a recognizable, accessible name for an interactive element. If an element has both attributes set, `aria-labelledby` will be used. `aria-labelledby` takes precedence over all other methods of providing an accessible name, including `aria-label`, {{HTMLElement('label')}}, and the element's inner text.
The `aria-labelledby` and [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) attributes both reference other elements to calculate text alternatives. `aria-labelledby` should reference brief text that provides the element with an accessible name. `aria-describedby` is used to reference longer content that provides a description. If there is no element in the DOM that provides a brief label appropriate for an accessible name for an interactive element, use `aria-label` to define the accessible name for an interactive element.
> **Note:** While in U.S. English the attribute would be assumed to be spelled "labeledby", the "labelledby" spelling has been established and is the spelling used in accessibility APIs.
The following example uses `aria-labelledby` to provide an accessible name for a checkbox input by using the text content of a sibling element:
```html
<span
role="checkbox"
aria-checked="false"
tabindex="0"
aria-labelledby="tac"></span>
<span id="tac">I agree to the Terms and Conditions.</span>
```
Note that while using `aria-labelledby` is similar in this situation to using an HTML {{HTMLElement('label')}} element with the `for` attribute, there are some very important differences. The `aria-labelledby` attribute only defines the accessible name. It doesn't provide any of `<label>`'s other functionality, such as making clicking on the labeling element activate the input it is associated with. That has to be added back in with JavaScript.
Fortunately, the HTML {{HTMLElement('input')}} with `type="checkbox"` works with native `<label>`. When feasible, use the following:
```html
<label for="tac">
<input id="tac" type="checkbox" name="terms-and-conditions" />
I agree to the Terms and Conditions.
</label>
<p><a href="tac.html">Read our Terms and Conditions</a>.</p>
```
### Benefits (and drawbacks)
1. The `aria-labelledby` property has the highest precedence when browsers calculate accessible names. Be aware that it overrides other methods of naming the element, including `aria-label`, other naming attributes, and even the element's contents.
```html
<button aria-label="Blue" aria-labelledby="color">Red</button>
<span id="color">Yellow</span>
```
In this example, that accessible name is "Yellow".
2. The `aria-labelledby` property takes as value a space-separated id reference list, which means you can combine more than one element into a single accessible name. You can include the [`id`](/en-US/docs/Web/HTML/Global_attributes#id) of the element itself to reference its own content.
```html
<h2 id="attr" class="article-title">13 ARIA attributes you need to know</h2>
<p>
There are over 50 ARIA states and properties, but 13 of them stand out…
<a href="13.html" id="rm13" aria-labelledby="rm13 attr">read more</a>
</p>
```
In this example, the accessible name is "read more 13 ARIA attributes you need to know".
3. The `aria-labelledby` property value order matters. When more than one element is referenced by `aria-labelledby`, the content from each referenced element is combined in the order that they are referenced in the `aria-labelledby` value. Had we written `aria-labelledby="attr rm13">`, the accessible name would have been "13 ARIA attributes you need to know read more".
4. The `aria-labelledby` property ignores repeated `id`s in its value. If an element is referenced more than one time, only the first reference is processed. `aria-labelledby="attr attr rm13 rm13">` is treated as `aria-labelledby="attr rm13">`
5. The `aria-labelledby` property value can include content from elements that aren't even visible. While you should provide assistive technology users with the same content as all other users, you can include content from elements with the HTML [`hidden`](/en-US/docs/Web/HTML/Global_attributes#hidden) attribute, CSS [`display: none`](/en-US/docs/Web/CSS/display), and CSS [`visibility: hidden`](/en-US/docs/Web/CSS/visibility) in the calculated name string.
6. The `aria-labelledby` property incorporates the value of input elements. If the value references an `<input>`, the current value of the form control is included in the calculated name string, changing if the value is updated.
7. The `aria-labelledby` property cannot be chained. If an element with `aria-labelledby` references another element that also has `aria-labelledby`, the `aria-labelledby` attribute on the referenced element is ignored.
> **Warning:** Because calculating the name of an element with `aria-labelledby` can be complex and reference hidden content, testing with assistive technologies to ensure the expected name is presented to users is very important.
## Values
- ID reference list
- : Space separated list of one or more ID values referencing the elements that label the current element.
## Associated roles
Used in almost all roles **except** roles that can not be provided an accessible name by the author.
The `aria-labelledby` attribute is **NOT** supported in:
- [`code`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`caption`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`deletion`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`emphasis`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`generic`](/en-US/docs/Web/Accessibility/ARIA/Roles/generic_role)
- [`insertion`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`mark`](/en-US/docs/Web/Accessibility/ARIA/Roles/mark_role)
- [`paragraph`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) / [`none`](/en-US/docs/Web/Accessibility/ARIA/Roles/none_role)
- [`strong`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`subscript`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`superscript`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`suggestion`](/en-US/docs/Web/Accessibility/ARIA/Roles/suggestion_role)
- [`term`](/en-US/docs/Web/Accessibility/ARIA/Roles/term_role)
- [`time`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement('label')}} element
- HTML {{HTMLElement('legend')}} element
- HTML {{HTMLElement('caption')}} element
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-valuetext/index.md | ---
title: aria-valuetext
slug: Web/Accessibility/ARIA/Attributes/aria-valuetext
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-valuetext
---
The `aria-valuetext` attribute defines the human-readable text alternative of `aria-valuenow` for a range widget.
## Description
Numbers — even percentages — aren't always user-friendly. Assistive technologies present [`aria-valuenow`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow) as numeric values. If a progress bar is at 8%, what does that mean? `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"`.
The `aria-valuetext` attribute is used with the `aria-valuenow` attribute, not instead of it, unless that value is not known.
`aria-valuetext` is only needed when the numeric value of `aria-valuenow` is not meaningful. For example, a range's values are numeric but may be used for non-numeric values, such as college class level. The values of `aria-valuenow` for a 4-year college could range from 1 through 4, which indicate the position of each value in the value space. In this case, the `aria-valuetext` could be one of the strings: "first year", "sophomore", "junior", and "senior".
If the numeric value is meaningful, such as a spinner with `aria-valuenow="3"` for how many pizza slices you want to order, `aria-valuetext` is not needed.
When both the `aria-valuetext` and `aria-valuenow` are included, the `aria-valuetext` is announced. When there is no `aria-valuetext` attribute, assistive technologies will announce the `aria-valuenow` attribute for the current value.
## Values
- `<string>`
- : A human-readable text alternative of the `aria-valuenow` value.
## Associated interfaces
- {{domxref("Element.ariaValueText")}}
- : The [`ariaValueText`](/en-US/docs/Web/API/Element/ariaValueText) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-valuetext` attribute.
- {{domxref("ElementInternals.ariaValueText")}}
- : The [`ariaValueText`](/en-US/docs/Web/API/ElementInternals/ariaValueText) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-valuetext` attribute.
## Associated roles
Used in roles:
- [`range`](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role)
- [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
Inherited into roles:
- [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role)
- [`progressbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role)
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
## Specifications
{{Specifications}}
## See also
- [`aria-valuenow`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-activedescendant/index.md | ---
title: aria-activedescendant
slug: Web/Accessibility/ARIA/Attributes/aria-activedescendant
page-type: aria-attribute
spec-urls:
- https://w3c.github.io/aria/#aria-activedescendant
- https://www.w3.org/TR/wai-aria-1.2/#aria-activedescendant
---
The `aria-activedescendant` attribute identifies the currently active element when focus is on a [`composite`](/en-US/docs/Web/Accessibility/ARIA/Roles/composite_role) widget, [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role), [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role), [`group`](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role), or [`application`](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role).
## Description
The `aria-activedescendant` property provides a method of managing focus for assistive technologies on interactive elements when they contain multiple focusable descendants, such as menus, grids, and toolbars. Instead of the screen reader moving focus between owned elements, `aria-activedescendant` can be used on container elements to refer to the currently active element, informing assistive technology users of the currently active element when focused.
With `aria-activedescendant`, the browser keeps the DOM focus on the container element or on an input element that controls the container element. However, the user agent communicates desktop focus events and states to the assistive technology as if the element referenced by `aria-activedescendant` has focus.
This attribute is only relevant on elements with role of [`composite`](/en-US/docs/Web/Accessibility/ARIA/Roles/composite_role) widget, [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role), [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role), [`group`](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role), or [`application`](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role) whose `id` is referenced as the attribute value.
The attribute manages providing assistive technologies with information as to which element has focus, but doesn't actually create focus. Changing focus and managing the attributes value is done with JavaScript. In addition to managing that attribute value, make sure the currently active descendant is visible and in view (or scrolls into view) when focused.
In setting the value of `aria-activedescendant` on an element with DOM focus, ensure the value refers to an owned element—either a descendant of the element with DOM focus OR a logical descendant as indicated by the [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns) attribute.
When the element with DOM focus is a combobox, textbox, or searchbox, include [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) to refer to the element that supports `aria-activedescendant`.
The value of `aria-activedescendant` refers to an owned element of the controlled element. For example, in a combobox, focus may remain on the combobox while the value of `aria-activedescendant` on the combobox element refers to a descendant of a popup listbox that is controlled by the combobox.
> **Note:** The attribute is supported only on a few roles. For example, `dialog`s do not support `aria-activedescendant`. When a combobox opens a dialog, DOM focus moves into the dialog from the combobox as it is not referenceable with this attribute.
> **Note:** When a descendant of a `listbox`, `grid`, or `tree` popup is focused, DOM focus remains on the combobox and the combobox has `aria-activedescendant` set to a value that refers to the focused element within the popup.
## Values
- ID reference
- : takes as its value the `id` of the currently focused element.
## Associated roles
Relevant only as an attribute on elements with the following roles:
- [`application`](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role)
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [`composite`](/en-US/docs/Web/Accessibility/ARIA/Roles/composite_role)
- [`group`](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role)
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
## Specifications
{{Specifications}}
## See also
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-required/index.md | ---
title: aria-required
slug: Web/Accessibility/ARIA/Attributes/aria-required
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-required
---
The `aria-required` attribute indicates that user input is required on the element before a form may be submitted.
## Description
When a semantic HTML {{htmlelement("input")}}, {{htmlelement("select")}}, or {{htmlelement("textarea")}} must have a value, it should have the [`required`](/en-US/docs/Web/HTML/Element/input#required) attribute applied to it. The HTML `required` attribute disables submitting the form unless the required form controls have valid values, while ensuring those navigating with the aid of assistive technologies understand which semantic form controls need valid content.
When form controls are created using non-semantic elements, such as a {{HTMLElement('div')}} with a [role](/en-US/docs/Web/Accessibility/ARIA/Roles) of [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role), the `aria-required` attribute should be included, with a value of `true`, to indicate to assistive technologies that user input is required on the element for the form to be submittable. The `aria-required` attribute can be used with HTML form elements; it is not limited to elements that have an ARIA role assigned.
Similar to the HTML `required` attribute set on semantic HTML form controls, the `aria-required` attribute explicitly conveys to assistive technologies that the element is required before a form may be submitted. The `required` attribute on a semantic HTML form control will prevent the form control from being submitted if no value is present — providing native error messaging in some browsers if a required value is invalid when the user attempts to submit the form. The `aria-required` attribute, like all ARIA states and properties, has no impact on element functionality. Functionality and behavior must be added in with JavaScript.
> **Note:** ARIA only modifies the accessibility tree, modifying how assistive technology presents content to users. ARIA does not change anything about an element's function or behavior. When not using semantic HTML elements for their intended purpose and default functionality, you must use JavaScript to manage behavior, focus, and ARIA states.
The CSS {{CSSXRef(':required')}} and {{CSSXRef(':optional')}} pseudoclasses match {{htmlelement("input")}}, {{htmlelement("select")}}, and {{htmlelement("textarea")}} elements based on whether they are required or optional, respectively. When using non-semantic elements as form controls, you don't get this CSS pseudoclass selector benefit. You can, however, use attribute selectors if the attribute is present: `[aria-required="true"]` or `[aria-required="false"]`.
If a form contains both required and optional form elements, the required elements should be indicated visually using a treatment that does not rely solely on color to convey meaning. Typically, descriptive text and/or an icon are used.
> **Note:** Which elements are required should be apparent to all users. Ensure the visual presentation indicates the form control is required in a consistent, visible manner, remembering that color is not enough to convey information.
## Examples
The attribute should be added to the form-control role. If the user needs to fill in an email address [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role), include `aria-required="true"` on the textbox.
```html
<div id="tbLabel">Email Address *</div>
<div
role="textbox"
contenteditable
aria-labelledby="tblabel"
aria-required="true"
id="email1"></div>
```
> **Note:** If the field's label already contains the word "required", it is recommended to leave out the `aria-required` attribute. This avoids that screen readers read out the term "required" twice.
In this example, JavaScript must be used to prevent the containing form from being submitted if the textbox has no content.
This could be written semantically, without the need for JavaScript:
```html
<label for="email1">Email Address (required)</label>
<input type="email" id="email1" required />
```
## Values
- `true`
- : The element requires a value or must be checked for the form to be submittable.
- `false`
- : The element is not required.
## Associated interfaces
- {{domxref("Element.ariaRequired")}}
- : The [`ariaRequired`](/en-US/docs/Web/API/Element/ariaRequired) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-required` attribute.
- {{domxref("ElementInternals.ariaRequired")}}
- : The [`ariaRequired`](/en-US/docs/Web/API/ElementInternals/ariaRequired) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-required` attribute.
## Associated roles
Used in roles:
- [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role)
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`radiogroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/radiogroup_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
- [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role)
Inherits into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role)
- [`switch`](/en-US/docs/Web/Accessibility/ARIA/Roles/switch_role)
- [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
## Specifications
{{Specifications}}
## See also
- HTML [`required`](/en-US/docs/Web/HTML/Element/input#required) attribute
- [`:optional` pseudoclass](/en-US/docs/Web/CSS/:optional)
- [`:required` pseudoclass](/en-US/docs/Web/CSS/:required)
- [`aria-invalid` attribute](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid)
- [MDN Understanding WCAG, Guideline 3.3 explanations](/en-US/docs/Web/Accessibility/Understanding_WCAG/Understandable#guideline_3.3_%e2%80%94_input_assistance_help_users_avoid_and_correct_mistakes)
- [Understanding Success Criterion 3.3.2 | W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/minimize-error-cues.html)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-modal/index.md | ---
title: aria-modal
slug: Web/Accessibility/ARIA/Attributes/aria-modal
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-modal
---
The `aria-modal` attribute indicates whether an element is modal when displayed.
## Description
A section of content is "modal" means navigation is limited to the area itself and the background (the ancestors and siblings of the modal) is hidden. Setting `aria-modal="true"` on [`dialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role) and [`alertdialog` role](/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role) containers indicates the presence of a "modal" element to users of assistive technology, but does not actually make the element modal. The features that make the element actually modal must be implemented by the developer.
> **Note:** ARIA only modifies the accessibility tree, modifying how assistive technology presents the content to your users. ARIA doesn't change anything about an element's function or behavior. To create a modal effect you must use JavaScript to manage behavior, focus, and ARIA states.
Relevant only on `dialog` and `alertdialog` containers, setting `aria-modal="true"` tells assistive technologies to let the user know the ability to interact with, or access other content on the page requires the modal dialog to be closed or otherwise lose focus.
Modal dialogs are when content is displayed and the user's interaction is limited to only that section until it is dismissed.
When creating modal dialogs, `aria-modal="true"` tells assistive technologies that the windows underneath the current dialog are not part of the modal content.
When a modal element is displayed, focus should be placed in the modal. Focus needs to be "trapped" inside the modal when it is visible, until it is dismissed. Assistive technology (<abbr>AT</abbr>) can then navigate the modal's content and understand the scope of the modal's content. The `aria-modal` attribute helps AT communicate the bounds of the modal and distinguishes it from the rest of the page's content. When dismissed, focus should return to the element that triggered the modal.
Ensure the modal is controllable using only its descendant elements. If a modal dialog has a close button, the button should be a descendant contained with the modal container in the DOM.
When a modal element is displayed, authors **should** mark all other contents as inert (such as "inert subtrees" in HTML). Disabled content is not inert content. Inert content cannot be interacted with using both normal and specialized browsing modes such as caret browsing, which allow an assistive technology user to explore a page in detail. This includes disabled content, whose content may provide meaning.
The [`inert`](/en-US/docs/Web/HTML/Global_attributes/inert) attribute is a boolean attribute that indicates, by its presence, that the element and all its shadow-including descendants are to be made inert. Until [`HTMLElement.inert`](/en-US/docs/Web/API/HTMLElement/inert) is fully supported, content can be [made inert with JavaScript](https://whistlr.info/2021/inert/).
Including `aria-modal="true"` on a [`dialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role) or [`alertdialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role), removes the requirement of putting [`aria-hidden`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden) on background content, as the `aria-modal` informs assistive technologies that content outside a dialog is inert. Note that while support for the {{HTMLElement("dialog")}} element is good, thoroughly testing your implementation is vitally important.
If a dialog is not modal — there is no inert background and focus isn't confined to the dialog — either include `aria-modal="false"` or omit the attribute altogether.
## Example
```html
<div id="backdrop" class="no-scroll">
<div
role="alertdialog"
aria-modal="true"
aria-labelledby="dialog_label"
aria-describedby="dialog_desc">
<h2 id="dialog_label">Confirmation</h2>
<div id="dialog_desc">
<p>Are you sure you want to delete this file?</p>
</div>
<button type="button" onclick="closeDialog(this)">
No. Close this popup.
</button>
<button type="button" onclick="deleteFile(this)">
Yes. Delete the file.
</button>
</div>
</div>
```
This partial example includes an `alertdialog` nested in a full-screen, non-scrollable backdrop.
The [`role="alertdialog"`](/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role) identifies the element that serves as the alert dialog container. The [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) provides the alert dialog an accessible name by referring to the element that provides the alert dialog title. The [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) attribute gives the alert dialog an {{glossary("accessible description")}} by referring to the alert dialog content that describes the primary message or purpose of the alert dialog.
The `aria-modal="true"` informs the assistive technology user that the content underneath the dialog is not interactive so long as the element with a declaration of `role="alertdialog"` has focus.
The `aria-modal` attribute exposes the existence of the modal to assistive technologies so the disabling of the content behind the modal can be communicated to AT users. Like all ARIA attributes, `aria-modal` itself has no effect on the page's functionality; focus management and disabling, interactivity on background elements, and the ability to remove focus from the alertdialog must all be managed with JavaScript.
## Values
- `false` (default)
- : Element is not modal.
- `true`
- : Element is modal.
## Associated interfaces
- {{domxref("Element.ariaModal")}}
- : The [`ariaModal`](/en-US/docs/Web/API/Element/ariaModal) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-modal` attribute.
- {{domxref("ElementInternals.ariaModal")}}
- : The [`ariaModal`](/en-US/docs/Web/API/ElementInternals/ariaModal) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-modal` attribute.
## Associated roles
Used in roles:
- [`window`](/en-US/docs/Web/Accessibility/ARIA/Roles/window_role)
Inherits into roles:
- [`alertdialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role)
- [`dialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role)
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement("dialog")}} element
- [`alertdialog` role](/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role)
- [`dialog` role](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role)
- HTML [`inert` global attribute](/en-US/docs/Web/HTML/Global_attributes/inert)
- HTMLElement API [`inert`](/en-US/docs/Web/API/HTMLElement/inert) property
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-hidden/index.md | ---
title: aria-hidden
slug: Web/Accessibility/ARIA/Attributes/aria-hidden
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-hidden
---
The `aria-hidden` state indicates whether the element is exposed to an accessibility API.
## Description
The `aria-hidden` attribute can be used to hide non-interactive content from the accessibility API.
Adding `aria-hidden="true"` to an element removes that element and all of its children from the accessibility tree. This can improve the experience for assistive technology users by hiding:
- Purely decorative content, such as icons or images
- Duplicated content, such as repeated text
- Offscreen or collapsed content, such as menus
The presence of the `aria-hidden` attribute hides content from assistive technology but doesn't visually hide anything.
`aria-hidden="true"` should not be used on elements that can receive focus. Additionally, since this attribute is inherited by an element's children, it should not be added onto the parent or ancestor of a focusable element.
> **Warning:** Do not use `aria-hidden="true"` on focusable elements.
An element's hidden status is based on whether it is rendered. Rendering is usually controlled by CSS. For example, an element whose `display` property is set to `none` via CSS is not rendered. An element is considered hidden if it, or any of its ancestors are not rendered or have their `aria-hidden` attribute value set to true. Note that an element and its children that has `aria-hidden="true"` declared on it will still be visible, unless also hidden by CSS.
Use caution when using `aria-hidden` to hide visibly rendered content from assistive technologies. You should not be hiding visible content unless doing so improves the experience for users of assistive technologies by removing redundant or extraneous content. Only when identical or equivalent meaning and functionality is exposed to assistive technologies can removing visible content from the accessibility API be considered.
> **Note:** Consider all disabilities when hiding visibly rendered content from assistive technologies. Not all users of assistive technology are visually impaired. If visible content doesn't match text content in the accessibility API, the user experience will be negatively impacted for sighted users.
On the surface, the `aria-hidden="true"` and the `role="presentation"` and its synonym `role="none"` seem similar, but the intent behind each is different.
- `aria-hidden="true"` will remove the entire element from the accessibility API.
- `role="presentation"` and `role="none"` will remove the semantic meaning of an element while still exposing it and its content to assistive technology.
`aria-hidden="true"` should not be added when:
- The HTML [`hidden`](/en-US/docs/Web/HTML/Global_attributes/hidden) attribute is present
- The element or the element's ancestor is hidden with [`display: none`](/en-US/docs/Web/CSS/display)
- The element or the element's ancestor is hidden with [`visibility: hidden`](/en-US/docs/Web/CSS/visibility)
In all three scenarios, the attribute is unnecessary to add because the element has already been removed from the accessibility tree. Visually hiding elements with `display` or `visibility` hides content from the screen and from assistive technologies.
Using `aria-hidden="false"` will not re-expose the element to assistive technology if any of its parents specify `aria-hidden="true"`.
## Example
Adding `aria-hidden="true"` to the icon hides the icon character from being included in the accessible name.
```html
<button>
<span class="fa fa-tweet" aria-hidden="true"></span>
<span class="label"> Tweet </span>
</button>
```
We have a button with [a Font Awesome icon](https://fontawesome.com/). We hide the icon from assistive technologies with `aria-hidden="true"`, as exposing the icon to assistive technologies could lead to redundancy or, if the icon doesn't have the same content as the visible text, confusion.
## Values
- `false`
- : The element is exposed to the accessibility API as if it was rendered.
- `true`
- : The element is hidden from the accessibility API.
- `undefined` (default)
- : The element's hidden state is determined by the user agent based on whether it is rendered.
## Associated interfaces
- {{domxref("Element.ariaHidden")}}
- : The [`ariaHidden`](/en-US/docs/Web/API/Element/ariaHidden) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-hidden` attribute, which Indicates whether the element is exposed to an accessibility API.
- {{domxref("ElementInternals.ariaHidden")}}
- : The [`ariaHidden`](/en-US/docs/Web/API/ElementInternals/ariaHidden) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-hidden` attribute
## Associated roles
Used in **ALL** roles
## Specifications
{{Specifications}}
## See also
- [`aria-disabled`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled)
- [`aria-modal`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal)
- [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded)
- HTML [`hidden`](/en-US/docs/Web/HTML/Global_attributes/hidden) attribute
- CSS {{CSSXref('display')}} property
- CSS {{CSSXref('visibility')}} property
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-atomic/index.md | ---
title: aria-atomic
slug: Web/Accessibility/ARIA/Attributes/aria-atomic
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-atomic
---
In ARIA live regions, the global `aria-atomic` attribute indicates whether assistive technologies such as a screen reader will present all, or only parts of, the changed region based on the change notifications defined by the [`aria-relevant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant) attribute.
## Description
Live regions are sections of a web page that are updated, whether by user interaction or not, when user focus is elsewhere. As they update outside the user's focus, assistive technologies such as screen readers may not "see" the update to report it to the user. WAI-ARIA has 4 properties that allow the developer to identify these live regions and tell the assistive technology how to process them, including [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live), [`aria-relevant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-relevant), [`aria-busy`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy) and `aria-atomic`.
When the content of a live region changes, the DOM is traversed from the changed element through its ancestors to find the first element with `aria-atomic` set. This determines the content that the user should be presented with.
If no ancestor has explicitly set `aria-atomic`, only the node or nodes of live region content that have been updated are read. The difference between omitting `aria-atomic` altogether and explicitly setting an ARIA live region's ancestor node with `aria-atomic="false"` is that explicitly setting `aria-atomic="false"` will stop the screen reader from going up the ancestor chain. Both lead to only the updated node being read. When set to `aria-atomic="true"`, the entire changed region as a whole will be presented, including the updated node's `label`, if there is one.
## Values
- `false` (default)
- : present only the changed node or nodes.
- `true`
- : present the entire changed region as a whole, including the author-defined label if one exists.
## Associated roles
Used in **ALL** [roles](/en-US/docs/Web/Accessibility/ARIA/Roles).
## Specifications
{{Specifications}}
## See also
- [Event.ariaAtomic](/en-US/docs/Web/API/Element/ariaAtomic)
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-current/index.md | ---
title: aria-current
slug: Web/Accessibility/ARIA/Attributes/aria-current
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-current
---
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.
## Description
When you have a group of related elements, such as several links in a breadcrumb or steps in a multi-step flow, with one element in the group styled differently from the others to indicate to the sighted user that this is the current element within its group, the `aria-current` should be used to inform the assistive technology user what has been indicated via styling.
In a breadcrumb list, when a link within a set of pagination links is styled to indicate the user is currently on that page, `aria-current="page"` should be set on that link. In a multi step based process with a step indicator such as a multi-page survey or a multi step checkout or registration process, when the current step icon is visually different to represent that it is the current step, that icon's container should have `aria-current="step"` for assistive technology users who may not be able to "see" the visual difference.
The `aria-current` attribute indicates the element on which it is set, to a value other than `false`, represents the current item within a container or set of related elements. Only mark one element in a set of elements as current with `aria-current`.
The `aria-current` attribute accepts a limited list of [values](#values) including `page`, `step`, `location`, `date`, `time`, `true`, and `false`. Any non-null string value not included in this list of enumerated values is treated as if `aria-current="true"` were set, not the default `false` value. If the attribute is not present, is an empty string, is present with no value, or is set to `aria-current="false"` it is not exposed to the user.
When something is selected rather than current, such as a [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) in a [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role), use [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) to indicate the currently-displayed tabpanel.
> **Note:** Don't use `aria-current` as a substitute for [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) in [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role), [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role), [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role) or [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role).
## Example
The breadcrumb for the "current page" should have `aria-current="page"` set on it.
```html
<nav aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="../../../../../">Web technology for developers</a>
</li>
<li>
<a href="../../../../">Accessibility</a>
</li>
<li>
<a href="../../../">ARIA</a>
</li>
<li>
<a href="../../">ARIA States and Properties</a>
</li>
<li>
<a href="./" aria-current="page">ARIA: `aria-current` attribute</a>
</li>
</ol>
</nav>
```
If the element representing the current page in the breadcrumb was not a link, the `aria-current` is optional.
## Values
- `page`
- : Represents the current page within a set of pages such as the link to the current document in a breadcrumb.
- `step`
- : Represents the current step within a process such as the current step in an enumerated multi step checkout flow .
- `location`
- : Represents the current location within an environment or context such as the image that is visually highlighted as the current component of a flow chart.
- `date`
- : Represents the current date within a collection of dates such as the current date within a calendar.
- `time`
- : Represents the current time within a set of times such as the current time within a timetable.
- `true`
- : Represents the current item within a set.
- `false` (default)
- : Does not represent the current item within a set.
## Associated interfaces
- {{domxref("Element.ariaCurrent")}}
- : The [`ariaCurrent`](/en-US/docs/Web/API/Element/ariaCurrent) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-current` attribute.
- {{domxref("ElementInternals.ariaCurrent")}}
- : The [`ariaCurrent`](/en-US/docs/Web/API/ElementInternals/ariaCurrent) property of the {{domxref("ElementInternals")}} interface reflects the value of the `aria-current` attribute.
## Associated roles
Usable in all roles; except in for elements with the role of [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role), [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role), [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role) and [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) where [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) should be used
## Specifications
{{Specifications}}
## See also
- [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected)
- {{cssxref(':local-link')}}
- [Breadcrumb navigation with `aria-current`](/en-US/docs/Web/CSS/Layout_cookbook/Breadcrumb_Navigation)
<section id="Quick_links">
<ol><li><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">ARIA States & Properties</a>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}</li></ol>
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-colspan/index.md | ---
title: aria-colspan
slug: Web/Accessibility/ARIA/Attributes/aria-colspan
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-colspan
---
The `aria-colspan` attribute defines the number of columns spanned by a cell or gridcell within a [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role), [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role), or [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role).
## Description
Intended for [`cell`s](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role) and [`gridcell`s](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role) which are not contained in a native HTML {{HTMLElement('table')}}, the `aria-colspan` property value defines the number of columns spanned by an individual cell an ARIA [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role), [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role), or [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role).
In HTML, {{HTMLElement('th')}} and {{HTMLElement('td')}} elements have the [`colspan`](/en-US/docs/Web/HTML/Element/td#attributes) attribute. When using the semantic {{HTMLElement('table')}}, use the native `colspan` attribute as designed. This ARIA attribute is intended for cells and gridcells which are not contained in a native table, and will be ignored if used on a cell in a {{HTMLElement('table')}}.
> **Note:** The first rule of ARIA use is if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and **adding** an ARIA role, state or property to make it accessible, then do so. Employ HTML {{HTMLelement('table')}} elements, including {{HTMLelement('td')}} and {{HTMLelement('th')}} with the `colspan` attribute instead of non-semantic elements with ARIA roles and attributes whenever possible.
The value of `aria-colspan` should be a positive integer. The default or assumed value of a cell span is 1. Make sure that the included value does cause the cell or gridcell to overlap the next cell or gridcell in the same row and does not cause the cell to span outside of the containing table, grid, or treegrid.
## Example
The following is an example of part of a bowling tournament league scoring spreadsheet. Each game spans 10 frames, and each frame spans a 3 scores: two balls and the current total. The 10th (and last) frame in each game spans 4 columns in case someone is scoring all strikes.
```html
<div role="grid" aria-rowcount="27">
aria-label="Bowling League Scores"
<div role="rowgroup">
<div role="row" aria-rowindex="1">
<!--
aria-rowspan and aria-colspan provide
assistive technologies with the correct data cell header information
when header cells span more than one row or column.
-->
<span role="columnheader" aria-rowspan="2">Team</span>
<span role="columnheader" aria-colspan="2">Player</span>
<span role="columnheader" aria-colspan="31">Game 1 Frames</span>
<span role="columnheader" aria-colspan="31">Game 2 Frames</span>
<span role="columnheader" aria-colspan="31">Game 3 Frames</span>
<span role="columnheader" aria-rowspan="2">Total</span>
</div>
<div role="row" aria-rowindex="2">
<span role="columnheader">Last Name</span>
<span role="columnheader">First Name</span>
<span role="columnheader" aria-colspan="3">1</span>
<span role="columnheader" aria-colspan="3">2</span>
<span role="columnheader" aria-colspan="3">3</span>
<span role="columnheader" aria-colspan="3">4</span>
<span role="columnheader" aria-colspan="3">5</span>
<span role="columnheader" aria-colspan="3">6</span>
<span role="columnheader" aria-colspan="3">7</span>
<span role="columnheader" aria-colspan="3">8</span>
<span role="columnheader" aria-colspan="3">9</span>
<span role="columnheader" aria-colspan="4">10</span>
<span role="columnheader" aria-colspan="3">1</span>
<span role="columnheader" aria-colspan="3">2</span>
<span role="columnheader" aria-colspan="3">3</span>
<span role="columnheader" aria-colspan="3">4</span>
<span role="columnheader" aria-colspan="3">5</span>
<span role="columnheader" aria-colspan="3">6</span>
<span role="columnheader" aria-colspan="3">7</span>
<span role="columnheader" aria-colspan="3">8</span>
<span role="columnheader" aria-colspan="3">9</span>
<span role="columnheader" aria-colspan="4">10</span>
<span role="columnheader" aria-colspan="3">1</span>
<span role="columnheader" aria-colspan="3">2</span>
<span role="columnheader" aria-colspan="3">3</span>
<span role="columnheader" aria-colspan="3">4</span>
<span role="columnheader" aria-colspan="3">5</span>
<span role="columnheader" aria-colspan="3">6</span>
<span role="columnheader" aria-colspan="3">7</span>
<span role="columnheader" aria-colspan="3">8</span>
<span role="columnheader" aria-colspan="3">9</span>
<span role="columnheader" aria-colspan="4">10</span>
</div>
</div>
<div role="rowgroup">
<div role="row" aria-rowindex="10">
<span role="rowheader" aria-rowspan="3">The Mighty Quokkas</span>
<span role="cell">Henderson</span>
<span role="cell">Alice</span>
<span role="cell">7</span>
<span role="cell">/</span>
<span role="cell">20</span>
<span role="cell" aria-colspan="2">X</span>
<span role="cell">39</span>
<span role="cell">9</span>
<span role="cell">-</span>
<span role="cell">48</span>
<span role="cell" aria-colspan="2">X</span>
<span role="cell">76</span>
<span role="cell" aria-colspan="2">X</span>
<span role="cell">96</span>
<span role="cell">8</span>
<span role="cell">/</span>
<span role="cell">113</span>
<span role="cell">7</span>
<span role="cell">-</span>
<span role="cell">120</span>
<span role="cell" aria-colspan="2">X</span>
<span role="cell">146</span>
<span role="cell" aria-colspan="2">X</span>
<span role="cell">166</span>
<span role="cell">6</span>
<span role="cell">/</span>
<span role="cell">X</span>
<span role="cell">186</span>
<span role="cell">7</span>
<span role="cell">2</span>
<span role="cell">9</span>
<span role="cell">6</span>
<span role="cell">-</span>
<span role="cell">15</span>
<span role="cell" aria-colspan="2">X</span>
<span role="cell">35</span>
<span role="cell">7</span>
<span role="cell">/</span>
…
</div>
<div role="row" aria-rowindex="11">
<span role="cell">McPherson</span>
<span role="cell">Leslie</span>
<span role="cell">9</span>
<span role="cell">-</span>
<span role="cell">9</span>
<span role="cell">8</span>
<span role="cell">1</span>
<span role="cell">18</span>
…
</div>
</div>
</div>
```
If we had used a {{HTMLElement('table')}} and semantic table elements our markup would have been less verbose and accessible by default.
## Values
- `<integer>`
- : An integer greater than or equal to the default value of 1 defining the number of columns spanned by the cell. The value must be less than what would cause a cell to overlap the next cell in the same row.
## Associated interfaces
- {{domxref("Element.ariaColSpan")}}
- : The [`ariaColSpan`](/en-US/docs/Web/API/Element/ariaColSpan) property, part of each element's interface, reflects the value of the `aria-colspan` attribute, which defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
## Associated roles
Used in roles:
- [`cell`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
Inherits into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
## Specifications
{{Specifications}}
## See also
- The {{HTMLElement('th')}} and {{HTMLElement('td')}} [`colspan`](/en-US/docs/Web/HTML/Element/td#attributes) attribute
- [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex) property
- [`aria-rowspan`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowspan) property
- [`cell`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role) role
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role) role
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role) role
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-rowindex/index.md | ---
title: aria-rowindex
slug: Web/Accessibility/ARIA/Attributes/aria-rowindex
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-rowindex
---
The `aria-rowindex` attribute defines an element's position with respect to the total number of rows within a table, grid, or treegrid.
## Description
Some tables have many, many rows. Loading only a subsection of rows may be done as a design requirement, to improve performance, or to improve user experience.
When only a subset of rows are loaded, you do need to let all users know which subsets of rows are being displayed. The `aria-rowindex` attribute is used to define the cell or row's row index or position with respect to the total number of rows within a table, grid, or treegrid.
Included on the {{HTMLElement('tr')}} element or on an element with a role of [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role), or directly on the {{HTMLElement('td')}}, {{HTMLElement('th')}}, or element with role of [`cell`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role) or [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role), the value is the row's position with respect to the full table.
The value for `aria-rowindex` is an integer greater than or equal to `1`, greater than the `aria-rowindex` value of any previous rows, and less than or equal to the number of rows in the full table.
If all of the rows are loaded and in the DOM, you don't need to include `aria-rowindex` as browsers automatically calculate the index of each row. However, when only a subset of the rows are present in the DOM, `aria-rowindex` is needed to indicate each row's position with respect to the full table. If only a subset of rows are loaded, you also need to include [`aria-rowcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowcount) on the table ancestor, even if you don't know the total rowcount.
If the table with only a subset of rows has a cell that spans more than one row, both the row and cell need to have the `aria-rowspan` set. If a cell spans more than one row-when a cell role includes the `aria-rowspan` attribute or HTML cell has a `rowspan` attribute set to a value greater than 1-include the row's `aria-rowindex` value on the spanning cell in addition to the appropriate row spanning attribute. The value should be the row index of the row where the span starts.
> **Note:** The `aria-rowindex` must be added to each row, but is optional on the cells, except for cells that span rows: the `aria-rowindex` attribute is required on all spanning cells.
## Examples
The following example shows a grid with 24 rows, of which the first row and rows 7 through 10 are displayed to the user. The last "position" cell spans column 9 and 10.
```html
<div role="grid" aria-rowcount="24">
<div role="rowgroup">
<div role="row" aria-rowindex="1">
<span role="columnheader">First Name</span>
<span role="columnheader">Last Name</span>
<span role="columnheader">Position</span>
</div>
</div>
<div role="rowgroup">
<div role="row" aria-rowindex="7">
<span role="gridcell">Morgan</span>
<span role="gridcell">Brian</span>
<span role="gridcell">Midfielder</span>
</div>
<div role="row" aria-rowindex="8">
<span role="gridcell">Abby</span>
<span role="gridcell">Dahlkemper</span>
<span role="gridcell">Defender</span>
</div>
<div role="row" aria-rowindex="9">
<span role="gridcell">Ashlyn</span>
<span role="gridcell">Harris</span>
<span role="gridcell" aria-rowspan="2" aria-rowindex="9">Goalkeeper</span>
</div>
<div role="row" aria-rowindex="10">
<span role="gridcell">Alyssa</span>
<span role="gridcell">Naeher</span>
</div>
</div>
</div>
```
Note both `aria-rowspan` and `aria-rowindex` are present on the Goalkeeper cell, which spans two rows.
## Values
- `<integer>`
- : An integer greater than or equal to 1, greater than the `aria-rowindex` of the previous row, if any, and less than or equal to the value of [`aria-rowcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowcount).
## Associated interfaces
- {{domxref("Element.ariaRowIndex")}}
- : The [`ariaRowIndex`](/en-US/docs/Web/API/Element/ariaRowIndex) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-rowindex` attribute.
- {{domxref("ElementInternals.ariaRowIndex")}}
- : The [`ariaRowIndex`](/en-US/docs/Web/API/ElementInternals/ariaRowIndex) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-rowindex` attribute.
## Associated roles
Used in roles:
- [`cell`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
- [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
Inherited into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
## Specifications
{{Specifications}}
## See also
- [`aria-rowindextext`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindextext)
- [`aria-rowcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowcount)
- [`aria-rowspan`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowspan)
- [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex)
- The [`rowspan`](/en-US/docs/Web/HTML/Element/td#rowspan) attribute on {{HTMLElement('td')}}
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-checked/index.md | ---
title: aria-checked
slug: Web/Accessibility/ARIA/Attributes/aria-checked
page-type: aria-attribute
spec-urls:
- https://w3c.github.io/aria/#aria-checked
- https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/examples/checkbox/
---
The `aria-checked` attribute indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
> **Note:** Where possible use an HTML {{htmlelement("input")}} element with `type="checkbox"` and `type="radio"` as these have built in semantics and do not require ARIA attributes.
## Description
The `aria-checked` attribute indicates whether the element is checked (`true`), unchecked (`false)`, or if the checked status is indeterminate (`mixed`), meaning it is neither checked nor unchecked. The `mixed` value is supported by the tri-state input roles of [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role) and [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role).
The `mixed` value is not supported on [`radio`](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role), [`menuitemradio`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role), or [`switch`](/en-US/docs/Web/Accessibility/ARIA/Roles/switch_role) and elements that inherits from these. The value will be false if `mixed` is set when not supported.
```html
<span
role="checkbox"
id="checkBoxInput"
aria-checked="false"
tabindex="0"
aria-labelledby="chk15-label"></span>
<label id="chk15-label">Subscribe to the newsletter</label>
```
> **Note:** Where possible use an HTML {{htmlelement("input")}} element with `type="checkbox"` as this element has built in semantics and does not require ARIA attributes.
The `tabindex` attribute is required to enable focus. JavaScript is required to toggle the `aria-checked` state. And, if this checkbox is part of a submittable form, more JavaScript is required to set a name and a value.
The above could have been written as:
```html
<input type="checkbox" id="chk15-label" name="Subscribe" />
<label for="chk15-label">Subscribe to the newsletter</label>
```
By using the {{htmlelement("input")}} element with `type="checkbox"` instead of ARIA, there is no need for any JavaScript.
## Values
- false
- : The element supports being checked but is not currently checked.
- true
- : The element is checked.
- mixed
- : for [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role) and [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role) only, equivalent to `indeterminate`, indicating a mixed mode value of neither checked nor unchecked.
- undefined (default)
- : The element does not support being checked.
## Associated roles
Used in roles:
- [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role)
- [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role)
- [`menuitemradio`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role)
- [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role)
- [`radio`](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role)
- [`switch`](/en-US/docs/Web/Accessibility/ARIA/Roles/switch_role)
## Associated interfaces
- {{domxref("Element.ariaChecked")}}
- : The [`ariaChecked`](/en-US/docs/Web/API/Element/ariaChecked) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-checked` attribute.
- {{domxref("ElementInternals.ariaChecked")}}
- : The [`ariaChecked`](/en-US/docs/Web/API/ElementInternals/ariaChecked) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-checked` attribute.
```js
myHTMLElement.ariaChecked = true;
```
## Specifications
{{Specifications}}
## See also
- [`<input type="checkbox">`](/en-US/docs/Web/HTML/Element/input/checkbox)
- [`<input type="radio">`](/en-US/docs/Web/HTML/Element/input/radio)
- [`aria-pressed`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed)
- [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected)
- [Two state checkbox example](https://www.w3.org/WAI/ARIA/apg/example-index/checkbox/checkbox.html) - w3.org
- [Mix-state checkbox example](https://www.w3.org/WAI/ARIA/apg/example-index/checkbox/checkbox-mixed.html) - w3.org
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-posinset/index.md | ---
title: aria-posinset
slug: Web/Accessibility/ARIA/Attributes/aria-posinset
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-posinset
---
The `aria-posinset` attribute defines an element's number or position in the current set of listitems or treeitems when not all items are present in the DOM.
## Description
Short for "position in set", the `aria-posinset` attribute defines the position of the element within the whole set of listitems or treeitems when only a subset of the items are present in the DOM.
If all the items in a list are present in the DOM, the browser can calculate the total and the position of each, making `aria-posinset` unnecessary. When only a portion of a set is in the DOM, include `aria-posinset` to provide information about the element's position within the set along with [`aria-setsize`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize) to inform the user how many items are in the full set.
The following example shows a listbox with four element options out of the 118 in the periodic table of chemical elements.
```html
<h2 id="periodic-table">Periodic table of chemical elements</h2>
<ul role="listbox" aria-labelledby="periodic-table">
<li role="option" aria-setsize="118" aria-posinset="1">Hydrogen</li>
<li role="option" aria-setsize="118" aria-posinset="3">Lithium</li>
<li role="option" aria-setsize="118" aria-posinset="11">Sodium</li>
<li role="option" aria-setsize="118" aria-posinset="19">Potassium</li>
</ul>
```
The value of each `aria-posinset` is an integer greater than or equal to `1`, and less than or equal to the size of the set when that size is known.
> **Note:** When using `aria-posinset` you must also include value for [`aria-setsize`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize), which is the size of the entire set. If the size of the entire set is unknown, set `aria-setsize="-1"`.
For [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role), [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role), or [`menuitemradio`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role), set the value of `aria-posinset` with respect to the total number of items in the menu, excluding any separators.
In a [`feed`](/en-US/docs/Web/Accessibility/ARIA/Roles/feed_role), each {{HTMLElement('article')}} element has `aria-posinset` set to a value that represents its position in the feed along with the `aria-setsize` set to either the number of articles that have been loaded or the total number in the feed, depending on which value is most helpful to users.
## Values
- `<integer>`
- : Integer greater than or equal to 1, and less than or equal to the value of `aria-setsize`.
## Associated interfaces
- {{domxref("Element.ariaPosInSet")}}
- : The [`ariaPosInSet`](/en-US/docs/Web/API/Element/ariaPosInSet) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-posinset` attribute.
- {{domxref("ElementInternals.ariaPosInSet")}}
- : The [`ariaPosInSet`](/en-US/docs/Web/API/ElementInternals/ariaPosInSet) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-posinset` attribute.
## Associated roles
Used in roles:
- [`article`](/en-US/docs/Web/Accessibility/ARIA/Roles/article_role)
- [`associationlistitemkey`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`associationlistitemvalue`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`comment`](/en-US/docs/Web/Accessibility/ARIA/Roles/comment_role)
- [`listitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role)
- [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role)
- [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role)
- [`radio`](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role)
- [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
Inherits into roles:
- [`comment`](/en-US/docs/Web/Accessibility/ARIA/Roles/comment_role)
- [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role)
- [`menuitemradio`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role)
- [`treeitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/treeitem_role)
## Specifications
{{Specifications}}
## See also
- [`aria-setsize`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-setsize/index.md | ---
title: aria-setsize
slug: Web/Accessibility/ARIA/Attributes/aria-setsize
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-setsize
---
The `aria-setsize` attribute defines the number of items in the current set of listitems or treeitems when not all items in the set are present in the DOM.
## Description
Browsers automatically calculate the set size and position for each item in a group of items, like the number of {{HTMLelement('li')}}s in a list, buttons in a same-named group of [radio buttons](/en-US/docs/Web/HTML/Element/input/radio), and {{HTMLelement('option')}}s in a {{HTMLelement('select')}}. Assistive technologies, like screen readers, take advantage of this state management to report set sizes to the user.
When the DOM is not complete, the browser calculation of the number of items in a set can be incorrect. When only a subset of items, such as list items, are loaded into the DOM, the browser calculates the number of items based only on those present. The `aria-setsize` attribute should be used to override the browser's incorrect count. It defines the number of items in the current set of listitems or treeitems had the entire set been loaded.
`aria-setsize` attribute is set on each item, rather than on any containing element. The value is the same for each item: an integer reflecting number of items in the complete set, or `-1` if the set size is unknown. If all the items are present in the DOM, the browser can calculate the set size and the position of each item, making both `aria-setsize` and `aria-posinset` unnecessary.
Elements with the `aria-setsize` generally have the [`aria-posinset`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset) attribute included as well to indicate the position of that item within the set. The `aria-posinset` value is between `1` and the positive value of `aria-setsize`.
For example, in a page's comments section, When comments in are not all in the DOM, such as when comments are paginated, the level, total number of comments, and position of each comment should be set with ARIA. The hierarchical level of comments can be indicated with [`aria-level`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level). Group positional information is indicated with `aria-posinset` and `aria-setsize`.
When a feed has a static number of articles, `aria-setsize` can be added to each article element with the value being either the total number of articles loaded or the total number in the feed. The value chosen depends on which value is most helpful to users. If the number of articles is extremely large, indefinite, or changes often, `aria-setsize="-1"` can be set to communicate the size of the set is unknown.
In a [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role), when the complete set of available options is not present in the DOM due to dynamic loading on scroll, both `aria-setsize` and `aria-posinset` can be set on each [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role).
In a tree view, if the complete set of available nodes is not present in the DOM due to dynamic loading as the user moves focus in or scrolls the tree, each node has `aria-level`, `aria-setsize`, and `aria-posinset` set.
In a menu, `aria-setsize` is set on all [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role), [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role), or [`menuitemradio`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role) roles, with the value being the total number of items in the menu, excluding any separators.
## Example
The following example shows items 5 through 8 in a set of 16.
```html
<h2 id="label_fruit">Available Fruit</h2>
<ul role="listbox" aria-labelledby="label_fruit">
<li role="option" aria-setsize="16" aria-posinset="5">apples</li>
<li role="option" aria-setsize="16" aria-posinset="6">bananas</li>
<li role="option" aria-setsize="16" aria-posinset="7">cantaloupes</li>
<li role="option" aria-setsize="16" aria-posinset="8">dates</li>
</ul>
```
To orient the user, assistive technologies would list the bananas above as "item 6 out of 16."
## Values
- `<integer>`
- : The number of items in the full set or `-1` is the set size is unknown.
## Associated interfaces
- {{domxref("Element.ariaSetSize")}}
- : The [`ariaSetSize`](/en-US/docs/Web/API/Element/ariaSetSize) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-setsize` attribute.
- {{domxref("ElementInternals.ariaSetSize")}}
- : The [`ariaSetSize`](/en-US/docs/Web/API/ElementInternals/ariaSetSize) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-setsize` attribute.
## Associated roles
Used in roles:
- [`article`](/en-US/docs/Web/Accessibility/ARIA/Roles/article_role)
- [`associationlistitemkey`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`associationlistitemvalue`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`comment`](/en-US/docs/Web/Accessibility/ARIA/Roles/comment_role)
- [`listitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role)
- [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role)
- [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role)
- [`radio`](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role)
- [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
Inherits into roles:
- [`comment`](/en-US/docs/Web/Accessibility/ARIA/Roles/comment_role)
- [`menuitemcheckbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role)
- [`menuitemradio`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role)
- [`treeitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/treeitem_role)
## Specifications
{{Specifications}}
## See also
- [`aria-posinset`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset)
- [Treegrid Email Inbox](https://www.w3.org/TR/2019/WD-wai-aria-practices-1.2-20191218/examples/treegrid/treegrid-1.html) example
- [Navigation Treeview Using Declared Properties](https://www.w3.org/TR/2019/WD-wai-aria-practices-1.2-20191218/examples/treeview/treeview-2/treeview-2b.html) example
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-roledescription/index.md | ---
title: aria-roledescription
slug: Web/Accessibility/ARIA/Attributes/aria-roledescription
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-roledescription
---
The `aria-roledescription` attribute defines a human-readable, author-localized description for the role of an element.
## Description
Some assistive technologies (<abbr>AT</abbr>), such as screen readers, present the role of an element as part of the user experience. The `aria-roledescription` attribute provides a way to define a different human-readable name to be presented by AT as the role of an element.
> **Note:** Only use aria-roledescription to clarify the purpose of non-interactive container roles and to provide a more specific description to a widget.
Users depend on the presentation of known role name to understand the purpose of the element and, if it is a widget, how to interact with it. So, only use `aria-roledescription` to clarify the purpose of non-interactive container roles like `group` or `region` and to provide a more specific description to a widget.
The `aria-roledescription` property overrides how ATs localize and express the name of a role. When you override a role name the user understands, you can potentially negatively impact a users' ability to understand and interact with an element.
Avoid using the `aria-roledescription` attribute. When a use case appears special worthy of a unique roledescription, the interactions can often times be broken down into smaller pieces that have relevant roles.
When there are no semantic or ARIA widget roles that correspond to the interaction model of your widget, use `role="application"`, provide an `aria-roledescription` with a human-readable, author-localized customized role name, and use `aria-describedby` to provide user instructions.
ATs may customize and localize the names of ARIA roles. If you are using `aria-roledescription` to change how the role name is presented to the user, remember to handle localization. The value should be translated when a page is localized.
Changing how the role is presented to the user has no impact on the functionality of the element. For example, if an element has a role of [`region`](/en-US/docs/Web/Accessibility/ARIA/Roles/region_role) or [`button`](/en-US/docs/Web/Accessibility/ARIA/Roles/button_role) when AT provides functions for navigating to the next region or button, if you set the `aria-roledescription` to `continent` and `escape` respectively, the AT will still allow those functions to navigate to regions and buttons.
Again, avoid using `aria-roledescription`. In this example, `escape` has no relevant meaning to the user, but `button` with "escape" as a label does.
When using `aria-roledescription`, also ensure that the element to which it is applied has a valid ARIA [`role`](/en-US/docs/Web/Accessibility/ARIA/Roles) or has implicit role semantics and that the value itself is not empty and contains more than just whitespace characters.
The `aria-roledescription` is required when using `aria-brailleroledescription`. Note that, in general, `aria-brailleroledescription` should only be used in rare cases when a `aria-roledescription` is excessively verbose when rendered in Braille.
## Examples
The following example shows the use of `aria-roledescription` to indicate that a non-interactive container is a "slide" in a web-based presentation application.
```html
<div
role="article"
aria-roledescription="slide"
id="slide"
aria-labelledby="slideheading">
<h1 id="slideheading">Quarterly Report</h1>
<!-- remaining slide contents -->
</div>
```
In the previous examples, a screen reader user may hear "Quarterly Report, slide" rather than the less precise "Quarterly Report, article".
## Values
- `<string>`
- : A non-empty string, an unconstrained value type, containing more than just white space.
## Associated interfaces
- {{domxref("Element.ariaRoleDescription")}}
- : The [`ariaRoleDescription`](/en-US/docs/Web/API/Element/ariaRoleDescription) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-roledescription` attribute.
- {{domxref("ElementInternals.ariaRoleDescription")}}
- : The [`ariaRoleDescription`](/en-US/docs/Web/API/ElementInternals/ariaRoleDescription) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-roledescription` attribute.
## Associated roles
Supported by all roles and by all base markup elements except for `role="generic"`.
## Specifications
{{Specifications}}
## See also
- [ARIA roles](/en-US/docs/Web/Accessibility/ARIA/Roles)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-placeholder/index.md | ---
title: aria-placeholder
slug: Web/Accessibility/ARIA/Attributes/aria-placeholder
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-placeholder
---
The `aria-placeholder` attribute defines a short hint (a word or short phrase) intended to help the user with data entry when a form control has no value. The hint can be a sample value or a brief description of the expected format.
## Description
A placeholder is text that appears in the form control when it has no value set. The HTML [`placeholder`](/en-US/docs/Web/HTML/Element/input#placeholder) attribute enables providing a sample value or a brief description of the expected format for several HTML {{HTMLElement('input')}} types and {{HTMLElement('textarea')}}.
If you are creating a `textbox` using any other element, `placeholder` is not supported. That is where `aria-placeholder` comes into play. The `aria-placeholder` attribute can be used to defines a short hint to help the user understand what type of data is expected when a non-semantic form control has no value.
```html
<span id="date-of-birth">Birthday</span>
<div
contenteditable
role="textbox"
aria-labelledby="date-of-birth"
aria-placeholder="MM-DD-YYYY">
MM-DD-YYYY
</div>
```
The placeholder hint should be shown to the user whenever the control's value is empty, including when a value is deleted.
> **Note:** ARIA is only modify the accessibility tree for an element and therefore how assistive technology presents the content to your users. ARIA doesn't change anything about an elements function or behavior. When not using semantic HTML elements for their intended purpose and default functionality, you must use JavaScript to manage behavior.
The `aria-placeholder` is used in addition to, not instead of, a label. They have different purposes and different functionality. A label explains what kind of information is expected. Placeholder text provides a hint about the expected value.
> **Warning:** Using a placeholder instead of a visible label harms accessibility and usability for many users including older users and users with cognitive, mobility, fine motor skill and vision impairments. Labels are better: they are always visible and they provide for a larger hit region to focus on the control. Placeholders have several drawbacks: they disappear when the control has any value including just white space, they can confuse users into thinking the value is pre-filled, and the default color has insufficient contrast.
> **Note:** Placeholders should only be used to show an example of the type of data that should be entered into a form; they don't replace a proper label.
## Values
- `<string>`
- : The word or short phrase to display in a control when the control has no value.
## Associated interfaces
- {{domxref("Element.ariaPlaceholder")}}
- : The [`ariaPlaceholder`](/en-US/docs/Web/API/Element/ariaPlaceholder) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-placeholder` attribute.
- {{domxref("ElementInternals.ariaPlaceholder")}}
- : The [`ariaPlaceholder`](/en-US/docs/Web/API/ElementInternals/ariaPlaceholder) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-placeholder` attribute.
## Associated roles
Used in roles:
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
Inherited into roles:
- [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role)
## Specifications
{{Specifications}}
## See also
- [HTML `placeholder` attribute](/en-US/docs/Web/HTML/Element/input#placeholder)
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-valuemax/index.md | ---
title: aria-valuemax
slug: Web/Accessibility/ARIA/Attributes/aria-valuemax
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-valuemax
---
The `aria-valuemax` attribute defines the maximum allowed value for a range widget.
## Description
The `aria-valuemax` attribute defines the maximum value allowed for range widgets. It is similar to the `max` attribute of {{HTMLElement('progress')}}, {{HTMLElement('meter')}}, and {{HTMLElement('input')}} of type [`range`](/en-US/docs/Web/HTML/Element/input/range), [`number`](/en-US/docs/Web/HTML/Element/input/number) and all the date-time types.
When creating a range type role, including [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role), [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role), [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role), and [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role) on a non-semantic element, the `aria-valuemax` enables defining a maximum that is more than the minimum value and is a required attribute of `slider`, `scrollbar` and `spinbutton`.
Declaring the minimum and maximum values allows assistive technologies to convey the size of the range to users. The minimum value is defined with [`aria-valuemin`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin).
> **Warning:** The [`range`](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role) role itself should **NOT** be used as it is an ["abstract"](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles). The `aria-valuemax` attribute is used on all of the range roles subtypes.
## Example
The code below shows a simple slider with a maximum value of 9.
```html
<div id="dimesLabel">Dimes</div>
<div
role="slider"
aria-valuenow="0"
aria-valuemin="0"
aria-valuemax="9"
aria-labelledby="dimesLabel"
id="dimes"></div>
```
## Values
- `<number>`
- : An integer or decimal number that is greater than the minimum value.
## Associated interfaces
- {{domxref("Element.ariaValueMax")}}
- : The [`ariaValueMax`](/en-US/docs/Web/API/Element/ariaValueMax) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-valuemax` attribute.
- {{domxref("ElementInternals.ariaValueMax")}}
- : The [`ariaValueMax`](/en-US/docs/Web/API/ElementInternals/ariaValueMax) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-valuemax` attribute.
## Associated roles
Used in roles:
- [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role)
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role) (required)
- [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role) (required)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role) (required)
Inherited into roles:
- [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role)
- [`progressbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role)
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
## Specifications
{{Specifications}}
## See also
- [`range` role](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role)
- [`<input type="range>` element `max` attribute](/en-US/docs/Web/HTML/Element/input/range#max)
- [`aria-valuemin`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin)
- [`aria-valuenow`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-braillelabel/index.md | ---
title: aria-braillelabel
slug: Web/Accessibility/ARIA/Attributes/aria-braillelabel
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-braillelabel
---
The global `aria-braillelabel` property defines a string value that labels the current element, which is intended to be converted into Braille.
## Description
The global `aria-braillelabel` attribute is similar to the global [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) in that it defines a string value that labels the current element. While `aria-label` is read by the screen reader, the contents of the `aria-braillelabel` attribute are converted into Braille; providing the user with a recognizable name of the object in Braille.
The purpose of the `aria-braillelabel` property is to override how assistive technologies localize and express the accessible name of an element in Braille and should only be used when accessible name, without this attribute, when converted to Braille, would not be the desired user experience.
When using `aria-braillelabel`, ensure that:
- The element to which `aria-braillelabel` is applied has a valid accessible name.
- The value of aria-braillelabel has actual content and is not empty or only whitespace in unicode or unicode Braille.
- The value is NOT the same as the accessible name.
- The `aria-braillelabel` values are localized to align with the document language.
- Communicate to the user that this attribute is available, especially if the content contains Unicode Braille Patterns, so the user knows to set the settings to apply user specific braille translations
> **Note:** Assistive Technologies with braille support can convert the accessible names to Braille.
> Therefore, only use `aria-braillelabel` when the accessible name is not the user experience you want.
Using only the accessible name, e.g., from content or via `aria-label` is almost always the better user experience, so don't use aria-braillelabel to replicate aria-label. Only use `aria-braillelabel` if the accessible name cannot provide an adequate braille representation.
```html
<button aria-braillelabel="***">
<img alt="3 out of 5 stars" src="three_stars.png" />
</button>
```
A braille display may display "btn \*\*\*" in Braille rather than the more verbose "btn gra 3 out of 5 stars".
## Values
- `<string>`
- : The value is a string, an unconstrained value type, that is intended to be converted into Braille.
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- [`aria-brailleroledescription`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-brailleroledescription)
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-brailleroledescription/index.md | ---
title: aria-brailleroledescription
slug: Web/Accessibility/ARIA/Attributes/aria-brailleroledescription
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-brailleroledescription
---
The global `aria-brailleroledescription` attribute defines a human-readable, author-localized abbreviated description for the role of an element intended to be converted into Braille.
## Description
Braille is not a one-to-one transliteration of letters and numbers, but rather it includes various abbreviations, contractions, and characters that represent words (known as logograms).
Instead of converting long role descriptions to Braille, the `aria-brailleroledescription` attribute allows for providing an abbreviated version of the [`aria-roledescription`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription) value, which is a human-readable, author-localized description for the role of an element, for improved user experience with Braille interfaces.
Basically, the value of `aria-brailleroledescription` is an abbreviated version of the `aria-roledescription` attribute to be converted into Braille.
```html
<article
aria-roledescription="slide"
aria-brailleroledescription="sld"
aria-labelledby="slide1heading">
<h1 id="slide1heading">Welcome to my talk</h1>
<img alt="Me" src="images/me.jpg" />
</article>
```
Most assistive technologies, like screen readers, will read the above as "slide, welcome to by talk. Image, Me." Braille assistive technologies will present "sld welcome to my talk gra me" in Braille. The semantic {{HTMLElement('article')}} is given the role of "slide" by the `aria-roledescription` attribute; "slide" being a role not defined in the specification, but is a common role for slides in a presentation. In Braille, the role is presented as "sld". The "gra" is short for "graphic", which is how the "image" role is shortened in Braille.
The `aria-brailleroledescription` attribute should only be used to clarify the purpose of non-interactive container roles like "group" or "region", or to provide a more specific description of a widget in a braille context.
As the `aria-brailleroledescription` attribute overrides how assistive technologies localize and express the name of a role in Braille, inappropriate values will prevent users from understanding and interacting with an element on braille interfaces.
Only use `aria-brailleroledescription` if [`aria-roledescription`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription) is present. However, if the `aria-roledescription` value works in Braille, the Braille version of the attribute is not needed. In general, `aria-brailleroledescription` should only be used in the rare case when a `aria-roledescription` is too verbose for Braille.
A few rules to remember:
- Only apply `aria-brailleroledescription` to elements with a valid ARIA role or elements with implicit role semantics.
- The `aria-brailleroledescription`, if present, must have a non-empty, none null value that is different from the `aria-roledescription` value, which, in turn, is different from the ARIA explicit or role or implicit semantic role.
- Avoid using Unicode Braille Patterns. If they must be used, ensure the `aria-brailleroledescription` value contains content other than Unicode Braille Patterns, whitespace, and Braille Pattern dots-0.
- Ensure the value is always localized to the document's language.
> **Warning:** If the content is only in Unicode Braille Patterns, the value will not be translated according to the user's preferred translation table.
> **Note:** Do NOT use `aria-brailleroledescription` to replicate `aria-roledescription`. Only include this attribute when `aria-roledescription` does not provide an adequate braille representation.
The `aria-brailleroledescription` value will not be exposed to the braille user if:
- The value is empty or contains only whitespace characters or the empty Braille pattern: dots-0 (U+2800).
- The element to which the attribute is applied has an explicit or implicit WAI-ARIA role where `aria-brailleroledescription` is prohibited, including the `generic` role.
- The element to which the attribute is applied does not have a valid `aria-roledescription`.
> **Note:** Test your sites and applications with daily users of assistive technologies, including Braille readers, to ensure your content makes sense in Braille.
## Values
- `<string>`
- : The value is a string, an unconstrained value type, that is intended to be converted into Braille
## Associated roles
Used in **ALL** roles (except [`generic`](/en-US/docs/Web/Accessibility/ARIA/Roles/generic_role)).
## Specifications
{{Specifications}}
## See also
- [`aria-roledescription`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription).
- [`Element.ariaRoleDescription`](/en-US/docs/Web/API/Element/ariaRoleDescription)
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-colcount/index.md | ---
title: aria-colcount
slug: Web/Accessibility/ARIA/Attributes/aria-colcount
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-colcount
---
The `aria-colcount` attribute defines the total number of columns in a [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role), [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role), or [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role) when not all columns are present in the [DOM](/en-US/docs/Glossary/DOM).
## Description
Some tables are very large, and it's not possible to show all the columns to the user. Or, it is possible, but having such a wide table would be a bad user experience. Use the `aria-colcount` attribute to let assistive technologies know how many columns the table would have if all columns were present. The value is an integer representing the number of columns that make up the full table. If you don't know the total number of columns a table will have, but know they will not all be in the DOM, use the value -1, so `aria-colcount="-1"`. This value tells the user agent that the current number of columns present in the DOM may not be the actual number of columns in the table.
If all columns in a table are present in the DOM, the `aria-colcount` attribute isn't needed, as browsers automatically calculate the total number of columns. However, if only a portion of the columns is present in the DOM at a given moment, that is when this attribute is helpful and needed.
When using `aria-colcount` when you have a known number of columns, make sure to also use [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex) to label each column, or, if the columns are contiguous-if it's a group of columns in the original order with no breaks-label each row.
The following example shows a grid with 6 columns, of which columns 1, 2, 5, and 6 are displayed to the user. The total number of columns that make up the table is set as `aria-colcount="6"` on the table itself. As the columns aren't contiguous, every [`cell`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role) - in this case [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role) and [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role) elements - have the `aria-colindex` attribute set.
```html
<div role="grid" aria-colcount="6">
<div role="rowgroup">
<div role="row">
<div role="columnheader" aria-colindex="1">First name</div>
<div role="columnheader" aria-colindex="2">Last name</div>
<div role="columnheader" aria-colindex="5">City</div>
<div role="columnheader" aria-colindex="6">Zip</div>
</div>
</div>
<div role="rowgroup">
<div role="row">
<div role="gridcell" aria-colindex="1">Debra</div>
<div role="gridcell" aria-colindex="2">Burks</div>
<div role="gridcell" aria-colindex="5">New York</div>
<div role="gridcell" aria-colindex="6">14127</div>
</div>
</div>
…
</div>
```
The first rule of ARIA use is "if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and **adding** an ARIA role, state or property to make it accessible, then do so." If we employ native HTML semantics with {{HTMLElement('table')}}, {{HTMLElement('th')}}, {{HTMLElement('td')}}, etc., the `aria-colcount` attribute is still necessary, but the mark up is not as verbose. When using semantic table header elements and not all columns are in the DOM, the `aria-colcount` must still be used, but the `aria-colindex` attribute only needs to be defined once per column in the column header {{HTMLElement('th')}}.
```html
<table aria-colcount="6">
<thead>
<tr>
<th aria-colindex="1" scope="col">First name</th>
<th aria-colindex="2" scope="col">Last name</th>
<th aria-colindex="5" scope="col">City</th>
<th aria-colindex="6" scope="col">Zip</th>
</tr>
</thead>
<tbody>
<tr>
<td>Debra</td>
<td>Burks</td>
<td>New York</td>
<td>14127</td>
</tr>
…
</tbody>
</table>
```
## Values
- `<integer>`
- : The number of columns in the full table
## Associated roles
Used in roles:
- [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role)
Inherits into roles:
- [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role)
- [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
## Specifications
{{Specifications}}
## See also
- [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex)
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-autocomplete/index.md | ---
title: aria-autocomplete
slug: Web/Accessibility/ARIA/Attributes/aria-autocomplete
page-type: aria-attribute
spec-urls:
- https://w3c.github.io/aria/#aria-autocomplete,
- https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-both/
---
The `aria-autocomplete` attribute indicates whether inputting text could trigger display of one or more predictions of the user's intended value for a [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role), [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role), or [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role) and specifies how predictions will be presented if they are made.
## Description
Autocompletion is user interface feature wherein inline suggestions are made as a user types in an input. Suggested text for completing the value of the field dynamically appears in the field after the input cursor, and the suggested value becomes the value if the user performs an action, such as tabbing, that causes focus to leave the field.
The `aria-autocomplete` property describes the type of autocompletion interaction model a textbox, searchbox, or combobox will use when dynamically helping users complete text input. It distinguishes between two models: the **inline** model (`aria-autocomplete="inline"`), which presents a single predicted value and the **list** model (`aria-autocomplete="list"`), which presents a collection of possible values in a separate element that pops up next to or below the text input, similar to a {{HTMLElement('datalist')}}. A third value, `aria-autocomplete="both"` is for when the interface will present a list while also including a predicted value. The default is `none`, meaning the textbox, searchbox, or combobox will not provide an auto complete value.
The `aria-autocomplete` property only describes the type of predictive behavior for an input element for assistive technologies; it doesn't provide the functionality. The actual autocompletion should be provided using HTML attributes or JavaScript.
If the suggested autocomplete value provides suggested values that aren't dependent on the input provided by the user, consider omitting autocomplete for everyone. For example, a searchbox input displaying unfiltered recent search terms may be helpful to a marketing team on an e-commerce site, but likely isn't helpful for the screen reader user. When it is best to not specify a value for `aria-autocomplete` or to set the value to the `none` default, likely your non-assistive technology users also don't need the experience.
When implementing autocomplete functionality, ensure the suggested portion of the value is presented as selected text to enable distinguishing between a user's input and the suggestion. Make sure that when the suggested value is not the desired value, users can easily delete the suggestion or replace it by continuing to type.
When implementing a list of values, DOM focus should remain on the text input while the suggestion list is displayed.
- include [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) with the value of the id of the suggested list of values.
- include [`aria-haspopup`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup) matching the role of the element that contains the collection of suggested values.
- manage focus, if required, including using [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant) if the collection container supports.
- use the [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) state on the element with role [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role) to communicate that the list is displayed.
If an autocomplete list value is automatically accepted when the field loses focus, the list must be contained in a role that supports `aria-activedescendant`, with the value of `aria-activedescendant` on the input field dynamically adjusted to refer to the element containing the selected suggestion.
## Values
- `none` (default)
- : When a user is providing input, no automatic suggestion is displayed.
- `inline`
- : `aria-autocomplete="inline"` text suggesting one way to complete the provided input may be dynamically inserted after the caret.
- `list`
- : `aria-autocomplete="list"` When a user is providing input, an element containing a collection of values that could complete the provided input may be displayed.
- `both`
- : `aria-autocomplete="both"` an input to offer both models at the same time. When a user is providing input, an element containing a collection of values that could complete the provided input may be displayed. If displayed, one value in the collection is automatically selected, and the text needed to complete the automatically selected value appears after the caret in the input.
## Associated roles
Used in roles:
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role) role
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role) role
- inherits from [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role) role
## Specifications
{{Specifications}}
## See also
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role) role
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role) role
- [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role) role
- {{HTMLElement('datalist')}} element and the [`<input> list` attribute](/en-US/docs/Web/HTML/Element/input#list)
- [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) attribute
- [`aria-haspopup`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup) attribute
- [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant) attribute
- [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute
- [Editable Combobox With Both List and Inline Autocomplete Example](https://www.w3.org/TR/wai-aria-practices-1.2/examples/combobox/combobox-autocomplete-both.html)
- [Event.ariaAutoComplete](/en-US/docs/Web/API/Element/ariaAutoComplete)
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-rowcount/index.md | ---
title: aria-rowcount
slug: Web/Accessibility/ARIA/Attributes/aria-rowcount
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-rowcount
---
The `aria-rowcount` attribute defines the total number of rows in a table, grid, or treegrid.
## Description
Some tables have hundreds, even millions, of rows. Even for tables with fewer rows, loading only a subsection of rows may be a design requirement, improve performance, or improve user experience. When only a subset of rows are loaded, you do need to let all users know that only a subset of the data is being displayed. The `aria-rowcount` attribute is used to define the total number of rows in a table, grid, or treegrid.
Included on the {{HTMLElement('table')}} element or on an element with a role of [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role), the value is the number of rows in the full table, as an integer. If the total number of rows is not known, include `aria-rowcount="-1"`, which tells the browser to not count the total number of rows.
If all of the rows are loaded and in the DOM, you don't need to include `aria-rowcount` as browsers automatically count the total number of rows. However, if the rows aren't all present in the DOM at any time, this attribute is needed to provide the number of rows when the full table size is known and to tell the browser to not automatically count the rows when the total number of rows is not known.
## Example
The following example shows a grid with 24 rows, of which the first row and rows 7 through 9 are displayed to the user.
```html
<div role="grid" aria-rowcount="24">
<div role="rowgroup">
<div role="row" aria-rowindex="1">
<span role="columnheader">First Name</span>
<span role="columnheader">Last Name</span>
<span role="columnheader">Position</span>
</div>
</div>
<div role="rowgroup">
<div role="row" aria-rowindex="7">
<span role="gridcell">Morgan</span>
<span role="gridcell">Brian</span>
<span role="gridcell">Midfielder</span>
</div>
<div role="row" aria-rowindex="8">
<span role="gridcell">Abby</span>
<span role="gridcell">Dahlkemper</span>
<span role="gridcell">Defender</span>
</div>
<div role="row" aria-rowindex="9">
<span role="gridcell">Ashlyn</span>
<span role="gridcell">Harris</span>
<span role="gridcell">Goalkeeper</span>
</div>
</div>
</div>
```
## Values
- `<integer>`
- : The number of rows in the full table or `-1` is the table size is not known.
## Associated interfaces
- {{domxref("Element.ariaRowCount")}}
- : The [`ariaRowCount`](/en-US/docs/Web/API/Element/ariaRowCount) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-rowcount` attribute.
- {{domxref("ElementInternals.ariaRowCount")}}
- : The [`ariaRowCount`](/en-US/docs/Web/API/ElementInternals/ariaRowCount) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-rowcount` attribute.
## Associated roles
Used in roles:
- [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
Inherited into roles:
- [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
## Specifications
{{Specifications}}
## See also
- [`aria-rowindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex)
- [`aria-colcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-flowto/index.md | ---
title: aria-flowto
slug: Web/Accessibility/ARIA/Attributes/aria-flowto
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-flowto
---
The global `aria-flowto` attribute identifies the next element (or elements) in an alternate reading order of content. This allows assistive technology to override the general default of reading in document source order at the user's discretion.
## Description
Web pages should be sequentially navigable. For this reason, developers are dissuaded from using the global [tabindex](/en-US/docs/Web/HTML/Global_attributes/tabindex) attribute which can change tab order and the CSS {{CSSXRef('order')}} property, which can change visual order from the DOM order. However, in rare circumstances a reading path different from the source order is required. For such cases, the `aria-flowto` attribute can make the content more accessible for users of assistive technologies.
The global `aria-flowto` attribute lets the author indicate to assistive technology users which element or elements might want to be focused on next, providing an alternate reading order to the source order. This allows assistive technology to read a document in an order other than the default document source reading order.
When `aria-flowto` has a single [id](/en-US/docs/Web/HTML/Global_attributes/id) reference, it allows assistive technologies to, at the user's request, go to the element targeted via that `id` instead of reading the document in the order of the DOM. When the `aria-flowto` value uses a space separated list of multiple `id` references, assistive technology can provide the user with a list of path choices, with each `id` referenced being a choice. The path choice names are determined by the accessible name of each target element of the `aria-flowto` attribute.
> **Note:** Setting `aria-flow` does not impact the content's tab order. It only provides users the option to follow a content path that doesn't match the DOM order when using tech that supports this attribute.
## Values
- `id`
- : Suggested next element in the reading order.
- `id` list
- : Space separated list of ID values referencing the suggested elements the user may want to go to next in the alternate reading order of content.
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- HTML [id](/en-US/docs/Web/HTML/Global_attributes/id) attribute
- HTML [tabindex](/en-US/docs/Web/HTML/Global_attributes/tabindex) attribute
- CSS {{CSSXRef('order')}} property
- [WCAG: source order](/en-US/docs/Web/Accessibility/Understanding_WCAG/Operable#guideline_2.4_—_navigable_provide_ways_to_help_users_navigate_find_content_and_determine_where_they_are)
- [Using aria-flowto](https://www.w3.org/WAI/GL/wiki/Using_aria-flowto) - W3 Wiki
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-sort/index.md | ---
title: aria-sort
slug: Web/Accessibility/ARIA/Attributes/aria-sort
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-sort
---
The `aria-sort` attribute indicates if items in a table or grid are sorted in ascending or descending order.
## Description
If a grid or table provides sort functionality, the `aria-sort` attribute should be set to either `ascending` or `descending` (or `other`) on the header cell element for the sorted column or row.
The `aria-sort` attribute is only set on the currently sorted column or row. Set `aria-sort="ascending"` to indicate the data cells in the column or row are sorted in ascending order. If the sort order is reversed, toggle the value to `aria-sort="descending"`. When a different column or row becomes sorted, the single `aria-sort` attribute is moved to the header cell for the newly sorted column or row with the appropriate value for the sort order.
The `aria-sort` attribute should only be added to a single table or grid header at a time. The attribute is set to inform assistive technology users which column or row is sorted. It doesn't have any impact on the actual sort order.
## Examples
This table loads with the last name column sorted in ascending order.
```html
<table>
<caption>
Steering Committee Members
</caption>
<thead>
<tr>
<th>
<button>First Name</button>
</th>
<th aria-sort="ascending">
<button>Last Name</button>
</th>
<th>
<button>Company</button>
</th>
<th>Email</th>
</tr>
</thead>
<tbody>
…
</tbody>
</table>
```
If a user clicks on the _Last Name_ button, [`aria-pressed="true"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed) would be added to the {{HTMLElement('button')}} element and the `aria-sort` value would be toggled to `"descending"` with JavaScript. If the user clicks on a different header button, the `aria-sort` would be removed from the _Last Name_ header to be placed on the clicked button's {{HTMLElement('th')}} parent.
We provided instructions in the caption for assistive technology who may not see the down arrows that we would add with CSS targeting the `th[aria-sort="ascending"]` and `th[aria-sort="descending"]` selectors.
## Values
- `ascending`
- : Items are sorted in ascending order by this column.
- `descending`
- : Items are sorted in descending order by this column.
- `none` (default)
- : There is no defined sort applied to the column.
- `other`
- : A sorting algorithm other than ascending or descending has been applied.
## Associated interfaces
- {{domxref("Element.ariaSort")}}
- : The [`ariaSort`](/en-US/docs/Web/API/Element/ariaSort) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-sort` attribute.
- {{domxref("ElementInternals.ariaSort")}}
- : The [`ariaSort`](/en-US/docs/Web/API/ElementInternals/ariaSort) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-sort` attribute.
## Associated roles
Used in roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
## Specifications
{{Specifications}}
## See also
- [Sortable table example](https://www.w3.org/TR/wai-aria-practices-1.2/examples/table/sortable-table.html) -W3C
- [`aria-pressed`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed)
- The {{HTMLElement('th')}} element
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-colindex/index.md | ---
title: aria-colindex
slug: Web/Accessibility/ARIA/Attributes/aria-colindex
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-colindex
---
The `aria-colindex` attribute defines an element's column index or position with respect to the total number of columns within a `table`, `grid`, or `treegrid`.
## Description
Some tables are very large, and as a result have only a portion of its content is initially displayed. While loading only a subsection of the columns may improve user experience, you need to let all users know what portions of the content are being displayed, and that all the table's content is not present.
ARIA provides several attributes to provide information about `table`, `grid`, and `treegrid` structures. The `aria-colindex` attribute defines the substructure, an element's column index or position with respect to the total number of columns, within such structures.
Used in conjunction with the [`aria-colcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount) attribute, which informs assistive technologies how many columns the table would have if all columns were present, the `aria-colindex` is used an element's column index or position with respect to that total number of columns.
If all of the columns are present in the DOM, including `aria-colindex` is not necessary as user agents can calculate the column index of each cell or gridcell. However, if any of the columns are left out of the DOM at any time, use `aria-colindex` to indicate the column of each cell or gridcell with respect to the full table.
The value for `aria-colindex` is an integer greater than or equal to 1. Each value should be greater than the previous column's `aria-colindex` and less than or equal to the number of columns in the full table.
If a cell or gridcell spans multiple columns, set [`aria-colspan`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colspan) to the number of columns it spans if not using {{htmlelement('td')}} and {{htmlelement('th')}} HTML elements, and set `aria-colindex` to the value of the start of the span; the value it would have had if it was only one column wide spanning only the first of its columns.
If the set of columns which is present in the DOM is contiguous, and if there are no cells which span more than one row or column in that set, you only have to put the `aria-colindex` once on each row on the first column of the set. If the columns are not contiguous, include the `aria-colindex` value on all of the children or owned elements of each row.
The following example shows a grid with 6 columns, of which columns 1, 2, 5, and 6 are displayed to the user. The total number of columns that make up the table is set as `aria-colcount="6"` on the table itself. As the columns aren't contiguous, every [`cell`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role) - in this case [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role) and [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role) elements - have the `aria-colindex` attribute set.
```html
<div role="grid" aria-colcount="6">
<div role="rowgroup">
<div role="row">
<div role="columnheader" aria-colindex="1">First name</div>
<div role="columnheader" aria-colindex="2">Last name</div>
<div role="columnheader" aria-colindex="5">City</div>
<div role="columnheader" aria-colindex="6">Zip</div>
</div>
</div>
<div role="rowgroup">
<div role="row">
<div role="gridcell" aria-colindex="1">Debra</div>
<div role="gridcell" aria-colindex="2">Burks</div>
<div role="gridcell" aria-colindex="5">New York</div>
<div role="gridcell" aria-colindex="6">14127</div>
</div>
</div>
…
</div>
```
The first rule of ARIA use is "if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and **adding** an ARIA role, state or property to make it accessible, then do so." If we employ native HTML semantics with {{HTMLElement('table')}}, {{HTMLElement('th')}}, {{HTMLElement('td')}}, etc., and only display a subsection of columns, the `aria-colcount` and `aria-colindex` attribute are still necessary, but the mark up is not as verbose.
When using semantic table header elements and not all columns are in the DOM, the `aria-colindex` attribute only needs to be defined once per column in the column header {{HTMLElement('th')}}.
```html
<table aria-colcount="6">
<thead>
<tr>
<th aria-colindex="1" scope="col">First name</th>
<th aria-colindex="2" scope="col">Last name</th>
<th aria-colindex="5" scope="col">City</th>
<th aria-colindex="6" scope="col">Zip</th>
</tr>
</thead>
<tbody>
<tr>
<td>Debra</td>
<td>Burks</td>
<td>New York</td>
<td>14127</td>
</tr>
…
</tbody>
</table>
```
If all the columns are in the DOM, neither `aria-colcount` nor `aria-colindex` are necessary.
## Values
- `<integer>`
- : Integer greater than or equal to 1 and less than or equal to the total number of columns if all were present.
## Associated interfaces
- {{domxref("Element.ariaColIndex")}}
- : The [`ariaColIndex`](/en-US/docs/Web/API/Element/ariaColIndex) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-colindex` attribute.
- {{domxref("ElementInternals.ariaColIndex")}}
- : The [`ariaColIndex`](/en-US/docs/Web/API/ElementInternals/ariaColIndex) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-colindex` attribute.
## Associated roles
Used in roles:
- [`cell`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
- [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
Inherits into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
## Specifications
{{Specifications}}
## See also
- [`aria-colindextext`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindextext) attribute
- [`aria-colcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount) attribute
- [`aria-colspan`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colspan) attribute
- HTML {{HTMLElement('table')}} element
- HTML {{HTMLElement('th')}} element
- HTML {{HTMLElement('td')}} element
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-orientation/index.md | ---
title: aria-orientation
slug: Web/Accessibility/ARIA/Attributes/aria-orientation
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-orientation
---
The `aria-orientation` attribute indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
## Description
It may be important for the user to know the orientation to know how to navigate certain widgets, as orientation impacts the expected behaviors of the left, right, up and down arrows. The `aria-orientation` attribute is used to indicate to assistive technology users whether an element's orientation is `horizontal` or `vertical`, or `undefined`.
Several widgets have default orientations:
Horizontal by default:
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role),
- [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role)
- [`toolbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/toolbar_role)
- [`menubar`](/en-US/docs/Web/Accessibility/ARIA/Roles/menubar_role)
Vertical by default:
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role)
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`menu`](/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role)
Each [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role) should have `aria-orientation` consistent with the separator's orientation.
When nodes in a tree are arranged horizontally instead of its default vertical orientation, or when a tab list is vertical instead of its default horizontal, the down arrow performs as a right arrow normally would, and the up arrow performs as a left arrow normally would. In these instances, assistive technology users need to know the widget's orientation so as to navigate correctly.
Up and down arrows are generally available for normal browser scrolling, even when focus is inside a tree or tab list. Include `aria-orientation` to enable alerting users when a widget doesn't have the default, expected orientation and associated navigation.
Always remember that ARIA only modifies how assistive technology presents content to your users; altering the behavior of arrow keys requires JavaScript.
## Values
- `horizontal`
- : The element is oriented horizontally.
- `undefined` (default)
- : The element's orientation is unknown/ambiguous.
- `vertical`
- : The element is oriented vertically.
## Associated interfaces
- {{domxref("Element.ariaOrientation")}}
- : The [`ariaOrientation`](/en-US/docs/Web/API/Element/ariaOrientation) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-orientation` attribute.
- {{domxref("ElementInternals.ariaOrientation")}}
- : The [`ariaOrientation`](/en-US/docs/Web/API/ElementInternals/ariaOrientation) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-orientation` attribute.
## Associated roles
Used in roles:
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`select`](/en-US/docs/Web/Accessibility/ARIA/Roles/select_role)
- [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role)
- [`toolbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/toolbar_role)
Inherited into roles:
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`menu`](/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role)
- [`menubar`](/en-US/docs/Web/Accessibility/ARIA/Roles/menubar_role)
- [`radiogroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/radiogroup_role)
- [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role)
- [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
## Specifications
{{Specifications}}
## See also
- [Understanding WCAG: Keyboard](/en-US/docs/Web/Accessibility/Understanding_WCAG/Keyboard)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-readonly/index.md | ---
title: aria-readonly
slug: Web/Accessibility/ARIA/Attributes/aria-readonly
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-readonly
---
The `aria-readonly` attribute indicates that the element is not editable, but is otherwise operable.
## Description
When you want to indicate that an interactive element works but is not editable, set `aria-readonly="true"`. This indicates to the user that an interactive element that would normally be focusable and copyable has been placed in a read-only (not disabled) state.
When `aria-readonly` is set to `true`, it means the user can read but not set the value of the widget. Read-only elements are still relevant to the user, so you should not prevent the user from navigating to the element or its focusable descendants or copying the value.
Examples include:
- Form elements which should not be changed.
- Row and column headers in a spreadsheet.
- The total value in a shopping cart.
If the non-changeable value shouldn't be able to receive focus, use [`aria-disabled`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled) instead.
> **Note:** When using semantic HTML form controls, if you set the `readonly` attribute, you don't need to include `aria-readonly="true"`.
> **Note:** The value of `<input type="checkbox">` can not be edited making `readonly` not relevant. However, when creating checkboxes with `role="checkbox"` the `aria-readonly` attribute _is_ supported.
## Values
- `true`
- : The element is readonly.
- `false` (default)
- : The element is not readonly.
## Associated interfaces
- {{domxref("Element.ariaReadOnly")}}
- : The [`ariaReadOnly`](/en-US/docs/Web/API/Element/ariaReadOnly) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-readonly` attribute.
- {{domxref("ElementInternals.ariaReadOnly")}}
- : The [`ariaReadOnly`](/en-US/docs/Web/API/ElementInternals/ariaReadOnly) property, part of the {{domxref("ElementInternals")}} interface, reflects the value of the `aria-readonly` attribute.
## Associated roles
Used in roles:
- [`checkbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role)
- [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role)
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [`radiogroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/radiogroup_role)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
- [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
Inherited into roles:
- [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [`searchbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role)
- [`switch`](/en-US/docs/Web/Accessibility/ARIA/Roles/switch_role)
- [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
## Specifications
{{Specifications}}
## See also
- [HTML `readonly` attribute](/en-US/docs/Web/HTML/Attributes/readonly)
- [`aria-disabled`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled)
<section id="Quick_links">
<strong><a href="/en-US/docs/Web/Accessibility/ARIA/Attributes">WAI-ARIA states and properties</a></strong>
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/aria/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/attributes | data/mdn-content/files/en-us/web/accessibility/aria/attributes/aria-description/index.md | ---
title: aria-description
slug: Web/Accessibility/ARIA/Attributes/aria-description
page-type: aria-attribute
spec-urls: https://w3c.github.io/aria/#aria-description
---
The global `aria-description` attribute defines a string value that describes or annotates the current element.
> **Note:** `aria-description` is still in W3C Editor's Draft for ARIA 1.3. For the time being, continue to use [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby), which has been supported since ARIA 1.1.
## Description
The global `aria-description` attribute provides a mechanism for the developer to describe or annotate the current element providing greater context for assistive technology users.
```html
<div
role="application"
aria-label="calendar"
aria-description="Game schedule for the Boston Red Sox 2021 Season">
<h1>Red Sox 2021</h1>
<div role="grid">…</div>
</div>
```
The `aria-description` attribute is similar to [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) in that both provide a text string to associate with the element, but a label should be short and concise, while the description can be longer as it is intended to provide more context and information.
The `aria-description` and `aria-describedby` properties have the same purpose; both provide the user with additional descriptive text for the object on which it is set. If descriptive text is available in the DOM, use [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) instead.
The `aria-description` property should only be used when providing a visible description is not the desired user experience. The `aria-describedby` attribute takes as its value a list of `id`s of the elements that contain descriptive text about the object. The `aria-description` is used when there is no appropriate descriptive text that can be associated with the object by `id` reference. If both attributes are present, `aria-describedby` takes precedence in defining the {{glossary("accessible description")}} property.
The content of the description, whether set by `aria-description` or `aria-describedby`, should be flat text. If the content is very long, has semantic meaning requirements, or has a navigational structure, use [`aria-details`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details) instead.
## Values
- `<string>`
- : The value is a string, an unconstrained value type, that is intended to be conveyed to the assistive technology user.
## Associated interfaces
- {{domxref("Element.ariaDescription")}}
- : The [`ariaDescription`](/en-US/docs/Web/API/Element/ariaDescription) property, part of the {{domxref("Element")}} interface, reflects the value of the `aria-description` attribute, which defines a string value that describes or annotates the current element.
## Associated roles
Used in **ALL** roles.
## Specifications
{{Specifications}}
## See also
- [HTML `title` attribute](/en-US/docs/Web/HTML/Global_attributes/title)
- [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby)
- [`aria-details`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details)
<section id="Quick_links">
1. [**WAI-ARIA states and properties**](/en-US/docs/Web/Accessibility/ARIA/Attributes)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Attributes")}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria | data/mdn-content/files/en-us/web/accessibility/aria/how_to_file_aria-related_bugs/index.md | ---
title: How to file ARIA-related bugs
slug: Web/Accessibility/ARIA/How_to_file_ARIA-related_bugs
page-type: guide
---
<section id="Quick_links">
<ol>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/Annotations">ARIA annotations</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/ARIA_Guides">ARIA guides</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions">ARIA live regions</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/ARIA_Screen_Reader_Implementors_Guide">ARIA screen reader implementors guide</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques">Using ARIA: Roles, states, and properties</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/Multipart_labels">Multipart labels</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/How_to_file_ARIA-related_bugs">How to file ARIA-related bugs</a></li>
<li class="toggle">
<details><summary>ARIA states and properties</summary>
{{ListSubpagesForSidebar("Web/Accessibility/ARIA/Attributes", 1)}}
</details>
</li>
<li class="toggle">
<details><summary>WAI-ARIA Roles</summary>
{{ListSubpagesForSidebar("Web/Accessibility/ARIA/Roles", 1)}}
</details>
</li>
</ol>
</section>
The state of ARIA technology has always depended on the community. If you notice an implementation issue, please take a little time and let the developers know. Here's where to file bugs:
### Screen Readers
<table style="width: 100%;">
<thead>
<tr>
<th>Software</th>
<th>Where to file</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://www.freedomscientific.com/products/fs/jaws-product-page.asp">Freedom Scientific JAWS</a></td>
<td><a href="https://www.freedomscientific.com/Forms/TechSupport">JAWS technical support form</a></td>
<td></td>
</tr>
<tr>
<td><a href="/en-US/docs/Mozilla/Developer_guide/Inner_and_outer_windows">GW Micro Window Eyes</a></td>
<td><a href="mailto:[email protected]">Window-Eyes comments, questions, and feedback</a></td>
<td></td>
</tr>
<tr>
<td><a href="http://www.nvda-project.org/">Non Visual Desktop Access (NVDA)</a></td>
<td><a href="http://www.nvda-project.org/wiki/ReportingIssues">File NVDA bugs</a></td>
<td>Discuss NVDA issues</td>
</tr>
</tbody>
</table>
### Browsers
<table style="width: 100%;">
<thead>
<tr>
<th>Software</th>
<th>Where to file</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apple Safari</td>
<td><a href="https://www.webkit.org/quality/reporting.html">File WebKit.org bugs</a></td>
<td></td>
</tr>
<tr>
<td>Google Chrome</td>
<td><a href="https://code.google.com/p/chromium/issues/list">File Chromium bugs</a></td>
<td></td>
</tr>
<tr>
<td>Mozilla Firefox</td>
<td><a href="https://bugzilla.mozilla.org/">File Firefox bugs </a></td>
<td>Use Component: Disability Access APIs</td>
</tr>
<tr>
<td>Opera</td>
<td><a href="https://bugs.opera.com/wizard/">File Opera bugs</a></td>
<td>Use [ARIA] in the summary field</td>
</tr>
</tbody>
</table>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria | data/mdn-content/files/en-us/web/accessibility/aria/aria_guides/index.md | ---
title: ARIA guides
slug: Web/Accessibility/ARIA/ARIA_Guides
page-type: landing-page
---
<section id="Quick_links">
<ol>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/Annotations">ARIA annotations</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/ARIA_Guides">ARIA guides</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions">ARIA live regions</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/ARIA_Screen_Reader_Implementors_Guide">ARIA screen reader implementors guide</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques">Using ARIA: Roles, states, and properties</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/Multipart_labels">Multipart labels</a></li>
<li><a href="/en-US/docs/Web/Accessibility/ARIA/How_to_file_ARIA-related_bugs">How to file ARIA-related bugs</a></li>
<li class="toggle">
<details><summary>ARIA states and properties</summary>
{{ListSubpagesForSidebar("Web/Accessibility/ARIA/Attributes", 1)}}
</details>
</li>
<li class="toggle">
<details><summary>WAI-ARIA Roles</summary>
{{ListSubpagesForSidebar("Web/Accessibility/ARIA/Roles", 1)}}
</details>
</li>
</ol>
</section>
Accessible Rich Internet Applications (**ARIA**) define ways to make the web more accessible to people with disabilities.
This page lists the guides that you can use to help improve the accessibility of web page features such as tables, forms, and keyboard-navigation.
- [Designing accessible forms](https://www.w3.org/WAI/tutorials/forms/)
- [Understanding WAI-ARIA basics](/en-US/docs/Learn/Accessibility/WAI-ARIA_basics)
- [Creating keyboard-navigable JavaScript widgets](/en-US/docs/Web/Accessibility/Keyboard-navigable_JavaScript_widgets)
- [Using ARIA for labels with embedded fields inside them](/en-US/docs/Web/Accessibility/ARIA/Multipart_labels)
- [Managing focus in composite widgets](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/) (`aria-activedescendant` vs. roving tabindex)
- [Testing ARIA](https://www.w3.org/WAI/test-evaluate/)
- [Displaying accessible tables](https://www.w3.org/WAI/tutorials/tables/)
## See also
The following references are helpful for common accessibility use cases:
- [Labeling widgets](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- [Landmark roles](/en-US/docs/Web/Accessibility/ARIA/Roles/landmark_role)
- [ARIA live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)
- [HTML Drag and Drop API](/en-US/docs/Web/API/HTML_Drag_and_Drop_API)
- [ARIA: presentation role](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role)
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria | data/mdn-content/files/en-us/web/accessibility/aria/roles/index.md | ---
title: WAI-ARIA Roles
slug: Web/Accessibility/ARIA/Roles
page-type: landing-page
---
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. <abbr>ARIA</abbr> roles can be used to describe elements that don't natively exist in HTML or exist but don't yet have full browser support.
By default, many semantic elements in HTML have a role; for example, `<input type="radio">` has the "radio" role. Non-semantic elements in HTML do not have a role; `<div>` and `<span>` without added semantics return `null`. The `role` attribute can provide semantics.
ARIA roles are added to HTML elements using `role="role type"`, where _role type_ is the name of a role in the ARIA specification. Some roles require the inclusion of associated ARIA states or properties; others are only valid in association with other roles.
For example, `<ul role="tabpanel">` will be announced as a 'tab panel' by screen readers. However, if the tab panel doesn't have nested tabs, the element with the tabpanel role is not in fact a tab panel and accessibility has actually been negatively impacted.
The [ARIA states and properties](/en-US/docs/Web/Accessibility/ARIA/Attributes) associated with each role are included in the role's pages, with each attribute also having a dedicated page.
## ARIA role types
There are 6 categories of ARIA roles:
### 1. Document structure roles
Document Structure roles are used to provide a structural description for a section of content. Most of these roles should no longer be used as browsers now support semantic HTML element with the same meaning. The roles without HTML equivalents, such as presentation, toolbar and tooltip roles, provide information on the document structure to assistive technologies such as screen readers as equivalent native HTML tags are not available.
- [toolbar](/en-US/docs/Web/Accessibility/ARIA/Roles/toolbar_role)
- [tooltip](/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role)
- [feed](/en-US/docs/Web/Accessibility/ARIA/Roles/feed_role)
- [math](/en-US/docs/Web/Accessibility/ARIA/Roles/math_role)
- [presentation](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) / [none](/en-US/docs/Web/Accessibility/ARIA/Roles/none_role)
- [note](/en-US/docs/Web/Accessibility/ARIA/Roles/note_role)
For most document structure roles, semantic HTML equivalent elements are available and supported. Avoid using:
- [application](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role)
- [article](/en-US/docs/Web/Accessibility/ARIA/Roles/article_role) (use {{HTMLElement('article')}})
- [cell](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role) (use {{HTMLElement('td')}})
- [columnheader](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role) (use `{{HTMLElement('th', '<th scope="col">')}}`)
- [definition](/en-US/docs/Web/Accessibility/ARIA/Roles/definition_role) (use {{HTMLElement('dfn')}})
- [directory](/en-US/docs/Web/Accessibility/ARIA/Roles/directory_role)
- [document](/en-US/docs/Web/Accessibility/ARIA/Roles/document_role)
- [figure](/en-US/docs/Web/Accessibility/ARIA/Roles/figure_role) (use {{HTMLElement('figure')}} instead)
- [group](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role)
- [heading](/en-US/docs/Web/Accessibility/ARIA/Roles/heading_role) (use {{HTMLElement("Heading_Elements", "h1")}} through {{HTMLElement("Heading_Elements", "h6")}})
- [img](/en-US/docs/Web/Accessibility/ARIA/Roles/img_role) (use {{HTMLElement('img')}} or {{HTMLElement('picture')}} instead)
- [list](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role) (use either {{HTMLElement('ul')}} or {{HTMLElement('ol')}} instead)
- [listitem](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role) (use {{HTMLElement('li')}} instead)
- [meter](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role) (use {{HTMLElement('meter')}} instead)
- [row](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role) (use the {{HTMLElement('tr')}} with {{HTMLElement('table')}})
- [rowgroup](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role) (use {{HTMLElement('thead')}}, {{HTMLElement('tfoot')}} and {{HTMLElement('tbody')}})
- [rowheader](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role) (use `{{HTMLElement('th','<th scope="row">')}}`)
- [separator](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role) (use {{HTMLElement('hr')}} if it doesn't have focus)
- [table](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role) (use {{HTMLElement('table')}})
- [term](/en-US/docs/Web/Accessibility/ARIA/Roles/term_role) (use {{HTMLElement('dfn')}})
These are included for completeness, but in most cases are rarely, if ever, useful:
- [`associationlist`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`associationlistitemkey`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`associationlistitemvalue`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`blockquote`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`caption`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`code`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`deletion`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`emphasis`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`insertion`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`paragraph`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`strong`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`subscript`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`superscript`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [`time`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
### 2. Widget roles
The various widget role are used to define common interactive patterns. Similar to the document structure roles, some of these roles duplicate the semantics of native HTML elements that are well supported, and should not be used. The difference between the two lists is that, generally, the widget roles require JavaScript interaction and the document structure roles don't necessarily.
- [scrollbar](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [searchbox](/en-US/docs/Web/Accessibility/ARIA/Roles/searchbox_role)
- [separator](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role) (when focusable)
- [slider](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [spinbutton](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
- [switch](/en-US/docs/Web/Accessibility/ARIA/Roles/switch_role)
- [tab](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
- [tabpanel](/en-US/docs/Web/Accessibility/ARIA/Roles/tabpanel_role)
- [treeitem](/en-US/docs/Web/Accessibility/ARIA/Roles/treeitem_role)
Avoid using [button](/en-US/docs/Web/Accessibility/ARIA/Roles/button_role), [checkbox](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role), [gridcell](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role), [link](/en-US/docs/Web/Accessibility/ARIA/Roles/link_role), [menuitem](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role), [menuitemcheckbox](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemcheckbox_role), [menuitemradio](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitemradio_role), [option](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role), [progressbar](/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role), [radio](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role), and [textbox](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role), which we've included for completeness. For most, semantic equivalents with accessible interactivity are available and supported. See the individual role documentation for more information.
#### Composite widget roles
- [combobox](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [menu](/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role)
- [menubar](/en-US/docs/Web/Accessibility/ARIA/Roles/menubar_role)
- [tablist](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role)
- [tree](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role)
- [treegrid](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
Avoid using [grid](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role), [listbox](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role), and [radiogroup](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role), which we've included for completeness. See the individual role documentation for more information.
Note that there is also a widget role (`role="widget"`), which is an abstract role and not in the widget role category.
### 3. Landmark roles
Landmark roles provide a way to identify the organization and structure of a web page. By classifying and labeling sections of a page, structural information conveyed visually through layout is represented programmatically. Screen readers use landmark roles to provide keyboard navigation to important sections of a page. Use these sparingly. Too many landmark roles create "noise" in screen readers, making it difficult to understand the overall layout of the page.
- [banner](/en-US/docs/Web/Accessibility/ARIA/Roles/banner_role) (document {{HTMLElement('header')}})
- [complementary](/en-US/docs/Web/Accessibility/ARIA/Roles/complementary_role) ({{HTMLElement('aside')}})
- [contentinfo](/en-US/docs/Web/Accessibility/ARIA/Roles/contentinfo_role) (document {{HTMLElement('footer')}})
- [form](/en-US/docs/Web/Accessibility/ARIA/Roles/form_role) ({{HTMLElement('form')}})
- [main](/en-US/docs/Web/Accessibility/ARIA/Roles/main_role) ({{HTMLElement('main')}})
- [navigation](/en-US/docs/Web/Accessibility/ARIA/Roles/navigation_role) ({{HTMLElement('nav')}})
- [region](/en-US/docs/Web/Accessibility/ARIA/Roles/region_role) ({{HTMLElement('section')}})
- [search](/en-US/docs/Web/Accessibility/ARIA/Roles/search_role) ({{HTMLElement('search')}})
### 4. Live region roles
Live Region roles are used to define elements with content that will be dynamically changed. Sighted users can see dynamic changes when they are visually noticeable. These roles help low vision and blind users know if content has been updated. Assistive technologies, like screen readers, can be made to announce dynamic content changes:
- [alert](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)
- [log](/en-US/docs/Web/Accessibility/ARIA/Roles/log_role)
- [marquee](/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role)
- [status](/en-US/docs/Web/Accessibility/ARIA/Roles/status_role)
- [timer](/en-US/docs/Web/Accessibility/ARIA/Roles/timer_role)
### 5. Window roles
Window roles define sub-windows to the main document window, within the same window, such as pop up modal dialogs:
- [alertdialog](/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role)
- [dialog](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role)
### 6. Abstract roles
Abstract roles are only intended for use by browsers to help organize and streamline a document. They should not be used by developers writing HTML markup. Doing so will not result in any meaningful information being conveyed to assistive technologies or to users.
Avoid using [command](/en-US/docs/Web/Accessibility/ARIA/Roles/command_role), [composite](/en-US/docs/Web/Accessibility/ARIA/Roles/composite_role), [input](/en-US/docs/Web/Accessibility/ARIA/Roles/input_role), [landmark](/en-US/docs/Web/Accessibility/ARIA/Roles/landmark_role), [range](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role), [roletype](/en-US/docs/Web/Accessibility/ARIA/Roles/roletype_role), [section](/en-US/docs/Web/Accessibility/ARIA/Roles/section_role), [sectionhead](/en-US/docs/Web/Accessibility/ARIA/Roles/sectionhead_role), [select](/en-US/docs/Web/Accessibility/ARIA/Roles/select_role), [structure](/en-US/docs/Web/Accessibility/ARIA/Roles/structure_role), [widget](/en-US/docs/Web/Accessibility/ARIA/Roles/widget_role),and [window](/en-US/docs/Web/Accessibility/ARIA/Roles/window_role).
> **Note:** Don't use abstract roles in your sites and applications. They are for use by browsers. They are included for reference only.
> **Warning:** "Abstract roles are used for the ontology. Authors **MUST NOT** use abstract roles in content." - The <abbr>WAI-ARIA</abbr> specification
## Roles defined on MDN
The following are the reference pages covering the WAI-ARIA roles discussed on <abbr>MDN</abbr>.
{{SubpagesWithSummaries}}
## See also
- [Using ARIA: Roles, States, and Properties](/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques)
- [ARIA states and properties](/en-US/docs/Web/Accessibility/ARIA/Attributes)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/radiogroup_role/index.md | ---
title: "ARIA: radiogroup role"
slug: Web/Accessibility/ARIA/Roles/radiogroup_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#radiogroup
- https://www.w3.org/WAI/ARIA/apg/patterns/radio/examples/radio/
---
The `radiogroup` role is a group of `radio` buttons.
## Description
Radio groups are collections describing a set of related [`radio`](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role) options. A `radiogroup` is a type of [`select`](/en-US/docs/Web/Accessibility/ARIA/Roles/select_role) list that can only have a single entry, or `radio`, checked at any one time.
When using HTML's native input radio button, [`<input type="radio">`](/en-US/docs/Web/HTML/Element/input/radio), the radio buttons are grouped when each of input radio buttons in the group is given the same [`name`](/en-US/docs/Web/HTML/Element/input#name). Once a group of same-named input radio buttons is established, selecting any input radio button in that group automatically deselects any currently-selected input radio button in the same group. While this will associate the radio buttons together, to expose a grouping of radio buttons as a `radiogroup` explicitly set the ARIA role.
It is recommended to create radio groups by using same-named HTML input radio buttons, but, if you must use ARIA roles and attributes instead of semantic HTML form controls, custom `radio` buttons can and should act like native HTML radio input buttons.
When using non-semantic elements as radio buttons, you must ensure your users can only select one radio button from the group at a time. When one item in the group is checked, having their [`aria-checked`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked) attribute set to `true`, the previously checked item becomes unchecked, with its `aria-checked` attribute becoming `false`. The `aria-checked` attribute is set on the associated `radio` roles, not on the `radiogroup` itself.
Some `radiogroup` implementations initialize the set with all buttons in the unchecked state. Once a `radio` in a `radiogroup` is checked, it is generally not possible to return to an all-unchecked state.
The `radiogroup` must have an accessible name either by a visible label referenced by [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) or has a label specified with [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label). If elements provide additional information about the radio group, those elements are referenced by the `radiogroup` element with the [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) property.
### Associated WAI-ARIA roles, states, and properties
- [`radio`](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role) role
- : One of a group of checkable buttons, in a `radiogroup`, where no more than one of the buttons can be checked at a time.
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) / [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- : The `radiogroup` must have an accessible name either by a visible label referenced by `aria-labelledby` or has a label specified with `aria-label`.
- [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby)
- : Reference to elements providing additional information about the `radiogroup`
- [`aria-required`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-required)
- : Indicates that one `radio` within the group must have `aria-checked="true"` set before the form may be submitted. The required state is specified on the `radiogroup` element rather than one of the `radio` elements, unlike when using HTML radio buttons where the [`required`](/en-US/docs/Web/HTML/Attributes/required) attribute is set directly on one or more radio {{HTMLElement('input')}} elements.
- [`aria-errormessage`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage)
- : Identifies the element that provides an error message for the `radiogroup`, if there is an error. That message should be hidden while not relevant.
### Keyboard interactions
For `radio` buttons in a `radiogroup` that is NOT in a [`toolbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/toolbar_role), the following keyboard interactions must be supported:
- <kbd>Tab</kbd> and <kbd>Shift + Tab</kbd>
- : Move focus into and out of the `radiogroup`. When focus moves into a `radiogroup`, if a radio button is checked, focus is set on the checked button. If none of the radio buttons are checked, focus is set on the first radio button in the group.
- <kbd>Space</kbd>
- : Checks the focused radio button if it is not already checked.
- <kbd>Right Arrow</kbd> and <kbd>Down Arrow</kbd>
- : Moves focus to the next radio button in the group, unchecking the previously focused button, and checking the newly focused button. If focus is on the last button, focus moves to the first button.
- <kbd>Left Arrow</kbd> and <kbd>Up Arrow</kbd>
- : Moves focus to the previous radio button in the group, unchecking the previously focused button, and checking the newly focused button. If focus is on the first button, focus moves to the last button.
Arrow keys are used to navigate among elements of a toolbar. When a `radiogroup` is nested inside a toolbar, users need to be able to navigate among all toolbar elements, including the radio buttons, without changing which radio button is checked. So, when navigating through a `radiogroup` in a [`toolbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/toolbar_role) with arrow keys, the button that is checked does not change. Rather, when inside a `toolbar`, the <kbd>Space</kbd> and <kbd>Enter</kbd> keys check the focused `radio` button if it is not already checked, with <kbd>Tab</kbd> moving focus into and out of the `toolbar`.
### Required JavaScript features
User interactions for `radiogroup`s must replicate the user interaction of a user entering into a group of same-named HTML radio buttons. Keyboard events for tabs, space, and arrow keys must be captured. Click events on both the radio elements and their associated labels must also be captured. Additionally, [focus must be managed](https://usability.yale.edu/web-accessibility/articles/focus-keyboard-operability).
While generally moving off an a focused element brings you to the next focusable element in the DOM order, using the arrow keys to navigate through a group of radio button keeps you in the group, moving focus to the first radio button when the <kbd>Right Arrow</kbd> or <kbd>Down Arrow</kbd> is released when focus was on the last radio in the group, and moving to the last radio if the <kbd>Left Arrow</kbd> or <kbd>Up Arrow</kbd> is released if focus was on the first radio. Managing roving [`tabindex`](/en-US/docs/Web/HTML/Global_attributes/tabindex) is one method to manage arrow key events.
### Required CSS features
Use the `[aria-checked="true"]` [attribute selector](/en-US/docs/Web/CSS/Attribute_selectors) to style the checked state of checked radio buttons.
Use CSS {{CSSXRef(':hover')}} and {{CSSXRef(':focus')}} pseudo-classes for styling visual keyboard focus and hover. The focus and hover effect should encompass both the radio button and label to make it easier to perceive which option is being chosen and to indicate that clicking either the label or button will activate the radio button.
## Examples
The basic set up for a `radiogroup` using non-semantic ARIA roles instead of semantic HTML is as follows:
```html
<div role="radiogroup" aria-labelledby="question">
<div id="question">Which is the best color?</div>
<div id="radioGroup">
<p>
<span
id="colorOption_0"
tabindex="0"
role="radio"
aria-checked="false"
aria-labelledby="purple"></span>
<span id="purple">Purple</span>
</p>
<p>
<span
id="colorOption_1"
tabindex="-1"
role="radio"
aria-checked="false"
aria-labelledby="aubergine"></span>
<span id="aubergine">Aubergine</span>
</p>
<p>
<span
id="colorOption_2"
tabindex="-1"
role="radio"
aria-checked="false"
aria-labelledby="magenta"></span>
<span id="magenta">Magenta</span>
</p>
<p>
<span
id="colorOption_3"
tabindex="-1"
role="radio"
aria-checked="false"
aria-labelledby="all"></span>
<span id="all">All of the above</span>
</p>
</div>
</div>
```
This could have been written using semantic HTML, which requires no CSS or JavaScript:
```html
<fieldset>
<legend>Which is the best color?</legend>
<p>
<input name="colorOption" type="radio" id="purple" />
<label for="purple">Purple</label>
</p>
<p>
<input name="colorOption" type="radio" id="aubergine" />
<label for="aubergine">Aubergine</label>
</p>
<p>
<input name="colorOption" type="radio" id="magenta" />
<label for="magenta">Magenta</label>
</p>
<p>
<input name="colorOption" type="radio" id="all" />
<label for="all">All of the above</label>
</p>
</fieldset>
```
In this {{HTMLElement('fieldset')}} example, while `role="radiogroup"` is not necessary, to have this grouping explicitly announced as `radiogroup`, include the ARIA role.
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement('fieldset')}} element
- HTML {{HTMLElement('input/radio', '<input type="radio">')}} radio button element
- [ARIA `radio` role](/en-US/docs/Web/Accessibility/ARIA/Roles/radio_role)
- [`aria-errormessage`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage)
- [`aria-invalid`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid)
- [`aria-readonly`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly)
- [`aria-required`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-required)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/structure_role/index.md | ---
title: "ARIA: structure role"
slug: Web/Accessibility/ARIA/Roles/structure_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#structure
---
The `structure` role is for document structural elements.
> **Note:** The `structure` role is an [abstract role](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles). It is included here for completeness of documentation. It should not be used by web authors.
## Description
`Structure` is a superclass [abstract role](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles) for document structures, like as [`document`](/en-US/docs/Web/Accessibility/ARIA/Roles/document_role),
[`rowgroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role), and [`sectionhead`](/en-US/docs/Web/Accessibility/ARIA/Roles/sectionhead_role), that support the accessibility of dynamic web content by helping assistive technologies determine active content versus static document content. Some subclass roles, like
[`section` role](/en-US/docs/Web/Accessibility/ARIA/Roles/section_role), are in turn superclasses of other roles.
The `structure` role is the superclass for all document structure roles, which are used to provide a structural description for a section of content. Most structure roles should no longer be used as browsers now support semantic HTML element with the same meaning. The structure roles without HTML equivalents, such as the [`presentation` role](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) which means content is presentational only, provide information on the document structure to assistive technologies such as screen readers as equivalent native HTML tags are not available.
## Best Practices
Do not use `role="structure"`. Do use HTML and subclass structure roles.
## Specifications
{{Specifications}}
## See also
- [ARIA: `roletype` role](/en-US/docs/Web/Accessibility/ARIA/Roles/roletype_role)
- [ARIA: `generic` role](/en-US/docs/Web/Accessibility/ARIA/Roles/generic_role)
- [ARIA: `presentation` role](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role)
- [ARIA: `range` role](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role)
- [ARIA: `section` role](/en-US/docs/Web/Accessibility/ARIA/Roles/section_role)
- [ARIA: `sectionhead` role](/en-US/docs/Web/Accessibility/ARIA/Roles/sectionhead_role)
<!-- these shouldn't be used so we shouldn't link to them
- [ARIA: `application` role](/en-US/docs/Web/Accessibility/ARIA/Roles/application_role)
- [ARIA: `document` role](/en-US/docs/Web/Accessibility/ARIA/Roles/document_role)
- [ARIA: `rowgroup` role](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role)
- [ARIA: `separator` role](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role)
-->
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/tabpanel_role/index.md | ---
title: "ARIA: tabpanel role"
slug: Web/Accessibility/ARIA/Roles/tabpanel_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#tabpanel
- https://www.w3.org/WAI/ARIA/apg/patterns/tabs/examples/tabs-manual/
---
The ARIA `tabpanel` is a container for the resources of layered content associated with a `tab`.
## Description
The `tabpanel` role indicates the element is a container for the resources associated with a [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) role, where each `tab` is contained in a [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role).
A `tabpanel` is part of a tab interface, a common user experience pattern in which a group of visual tabs allow for quickly switching between multiple layered views. Each tab is defined as such with the `tab` role, and these tabs are contained within an element with the `tablist` role. The `tablist` is often visually positioned above or to the side of a content area, containing the associated tabpanels. The `tabpanel` is the role of the container for each pane of content that is associated with a corresponding `tab` in the tab interface's `tablist`.
In many tab interfaces, only a single `tabpanel` will be visible at a time. However, some interfaces may require multiple tab panels to be displayed at once. In these cases the `tablist` would be provided the [`aria-multiselectable`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable) attribute, and the `tab` elements would then use the [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute to indicate whether its associated `tabpanel` was visible or not. The tab's selected state would instead be used to indicate which tabpanel is the currently 'active' panel. For example, this could indicate which tabpanel keyboard focus would move to if someone were to press the <kbd>tab</kbd> key when focused on an tab within the multi-select `tablist`.
In single-select tab interfaces, only the `tabpanel` associated with the currently selected tab is displayed. All other `tabpanel` elements associated with the unselected tabs must be hidden from users. So when tab selection changes, the displayed tabpanel would also, while the previously-displayed tabpanel would then become hidden.
In multi-select tab interfaces, multiple `tabpanel` elements may be displayed, matching the expanded state of their associated `tab` elements.
Tabs do not act as anchor links to individual panels — and upon activation, keyboard focus should remain on the current `tab` element and not automatically move to the newly displayed `tabpanel`. While a tab interface may be progressively enhanced based off an underlying markup pattern of in-page hyperlinks pointing to their associated sections of content, when JavaScript is used to modify these elements into a tabbed interface, the hyperlinks' default behavior should be prevented. Ideally, this could be done by removing or modifying the `href` attribute, as this would have the added benefit of removing the hyperlink-specific menu items from the element's browser context menu.
When keyboard focus is on a `tablist`, or a `tab` within the `tablist`, the <kbd>Tab</kbd> key should be programmed to move from the focused tab — which may or may not be the selected tab — to the `tabpanel` which represents the currently selected tab.
Each `tab` in a `tablist` can serve as the label for its corresponding `tabpanel`. Include the `id` of each `tab` as the value for each `tabpanel`'s [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) attribute.
You can also optionally associate each `tabpanel` with its associated `tab` by including the [`id`](/en-US/docs/Web/HTML/Global_attributes#id) of the `tabpanel` as the value of the `tab`'s [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) attribute.
When a tabbed interface is initialized, one `tabpanel` is displayed and its associated `tab` is styled to indicate that it is active, reflecting its programmatic state. All inactive `tabpanel` elements must be hidden to all users. This is most commonly achieved by use of CSS's `display: none`.
See the [ARIA `tab` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) article for more information specific to the use of this role.
Include [`tabindex="-1"`](/en-US/docs/Web/HTML/Global_attributes/tabindex) to allow a `tabpanel` to receive focus without including the `tabpanel` in the page's keyboard focus order.
Make sure to define styles for a `tabpanel` for when it receives focus, optimally using the CSS {{CSSXref(':focus')}} pseudo-class, so keyboard users know there was a change in focus and are aware of what content currently has focus.
Carousels can be created using this tab pattern: A slide picker controls can be marked up as `tabs` in a `tablist` with the slide represented by a `tabpanel` element.
### Associated Roles and Attributes
- [`tab` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
- : Controls the visibility of the associated `tabpanel`
- [`tablist` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role)
- : Group of `tab` elements.
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : Provides an accessible name. References the `tab` element that controls the panel
- [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded)
- : Should be used on the necessary `tab` elements if a multi-selectable `tablist` is used.
### Keyboard interaction
See the [`tablist` keyboard interactions](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role#keyboard_interaction) in the [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role) role definition.
## Example
See the [`tabpanel`, `tab`, and `tablist` example](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role#example) in the [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) role definition.
## Specifications
{{Specifications}}
## See also
- [ARIA `tab` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
- [ARIA `tablist` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role)
- [Example: Tabs with Automatic Activation](https://www.w3.org/WAI/ARIA/apg/example-index/tabs/tabs-automatic.html) - W3C
- [Example: Tabs with Manual Activation](https://www.w3.org/WAI/ARIA/apg/example-index/tabs/tabs-manual.html) -W3C
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/suggestion_role/index.md | ---
title: "ARIA: suggestion role"
slug: Web/Accessibility/ARIA/Roles/suggestion_role
page-type: aria-role
---
The `suggestion` role semantically denotes a single proposed change to an editable document. This should be used on an element that wraps an element with an `insertion` role, and one with a `deletion` role.
## Examples
When you've got a content change that involves an insertion _and_ a deletion, there is no way for a screen reader user to work out if the two are related or not. This is the job of `role="suggestion"`, which should be set on an element wrapping both of them like so:
```html
<p>
Freida's pet is a
<span role="suggestion">
<span role="deletion">black Cat called Luna</span>
<span role="insertion">purple T. Rex called Tiny</span></span
>.
</p>
```
We could even provide an information box saying who made the suggestion and when, and associate it with the suggestion via [`aria-details`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details):
```html
<p>
Freida's pet is a
<span role="suggestion" aria-details="comment-source">
<span role="deletion">black Cat called Luna</span>
<span role="insertion">purple T. Rex called Tiny</span></span
>.
</p>
<div id="comment-source">
Suggested by Chris,
<time datetime="2019-03-30T19:29">March 30 2019, 19:29</time>
</div>
```
Browsers tend to provide a default black strikethrough for deletions, and a black underline for insertions, but you'll probably want to use
## Best practices
### Prefer HTML
Using the [`<ins>`](/en-US/docs/Web/HTML/Element/ins) and [`<del>`](/en-US/docs/Web/HTML/Element/del) element will automatically communicate a section has a role of `insertion` or `deletion`. If at all possible, prefer using the HTML elements.
## Specifications
Will be part of WAI-ARIA 1.3, which is still being drafted.
## See also
- [ARIA annotations](/en-US/docs/Web/Accessibility/ARIA/Annotations)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/comment_role/index.md | ---
title: "ARIA: comment role"
slug: Web/Accessibility/ARIA/Roles/comment_role
page-type: aria-role
---
The `comment` role semantically denotes a comment/reaction to some content on the page, or to a previous comment.
> **Note:** The comment role is proposed in WAI-ARIA 1.3 ([Most recent ARIA draft](https://w3c.github.io/aria/)), which is still being drafted.
## Examples
In the following example we have a document section that has been commented. The commented section is marked up using `<span role="mark">`.
The related comment is marked up using an HTML structure wrapped with a `<div>` containing `role="comment"`.
```html
<p>
The last half of the song is a slow-rising crescendo that peaks at the
<span role="mark" aria-details="thread-1">end of the guitar solo</span>,
before fading away sharply.
</p>
<div role="comment" id="thread-1" data-author="chris">
<h3>Chris said</h3>
<p class="comment-text">I really think this moment could use more cowbell.</p>
<p><time datetime="2019-03-30T19:29">March 30 2019, 19:29</time></p>
</div>
```
To associate the comment with the text being commented, we need to wrap the commented text with an element containing the [`aria-details`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details) attribute, the value of which should be the ID of the comment.
### Multiple comments
Since `aria-details` can now accept multiple IDs, we can associate multiple comments with the same annotation, like so:
```html
<p>
The last half of the song is a slow-rising crescendo that peaks at the
<mark aria-details="thread-1 thread-2">end of the guitar solo</mark>, before
fading away sharply.
</p>
<div role="comment" id="thread-1" data-author="chris">
<h3>Chris said</h3>
<p class="comment-text">I really think this moment could use more cowbell.</p>
<p><time datetime="2019-03-30T19:29">March 30 2019, 19:29</time></p>
</div>
<div role="comment" id="thread-2" data-author="chris">
<h3>Marcus said</h3>
<p class="comment-text">
The guitar solo could do with a touch more chorus, and a slightly lower
volume.
</p>
<p><time datetime="2019-03-29T15:35">March 29 2019, 15:35</time></p>
</div>
```
### Nested comments
Nested comments are also possible with ARIA annotations — nest the comments inside one another, like so:
```html
<div role="comment" id="thread-1" data-author="chris">
<h3>Chris said</h3>
<p class="comment-text">I really think this moment could use more cowbell.</p>
<p><time datetime="2021-03-30T19:29">March 30 2021, 19:29</time></p>
<div role="comment" data-author="marcus">
<h3>Marcus replied</h3>
<p class="comment-text">
I don't know about that. I think the cowbell could distract from the solo.
</p>
<p><time datetime="2021-03-30T21:02">March 30 2021, 21:02</time></p>
</div>
</div>
```
## Accessibility concerns
None
## Specifications
Will be part of WAI-ARIA 1.3, which is still being drafted.
## See also
- [ARIA annotations](/en-US/docs/Web/Accessibility/ARIA/Annotations)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/progressbar_role/index.md | ---
title: "ARIA: progressbar role"
slug: Web/Accessibility/ARIA/Roles/progressbar_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#progressbar
---
The `progressbar` role defines an element that displays the progress status for tasks that take a long time.
## Description
The `progressbar` range widget indicates that a request has been received and the application is making progress toward completing the requested action.
Authors **may** set aria-valuemin and aria-valuemax to indicate the minimum and maximum progress indicator values. Otherwise, their implicit values follow the same rules as HTML's [`<input type="range"`>](/en-US/docs/Web/HTML/Element/input/range):
- If [`aria-valuemin`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin) is missing or not a number, it defaults to `0` (zero).
- If [`aria-valuemax`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax) is missing or not a number, it defaults to `100`.
- The `aria-valuemin` and `aria-valuemax` properties only need to be set for the `progressbar` role when the progress bar's minimum is not `0` or the maximum value is not `100`.
- The read-only [`aria-valuenow`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow) should be provided and updated unless the value is `indeterminate`, in which case don't include the attribute. If set, make sure the `aria-valuenow` value is between the minimum and maximum values.
If the `progressbar` role is applied to an HTML {{HTMLElement('progress')}} element, the accessible name can come from the associated {{HTMLElement('label')}}. Otherwise use [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) if a visible label is present or [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) if a visible label is not present.
### All descendants are presentational
There are some types of user interface components that, when represented in a platform accessibility API, can only contain text. Accessibility APIs do not have a way of representing semantic elements contained in a `progressbar`. To deal with this limitation, browsers, automatically apply role [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) to all descendant elements of any `progressbar` element as it is a role that does not support semantic children.
For example, consider the following `progressbar` element, which contains a heading.
```html
<div role="progressbar"><h3>Title of my progressbar</h3></div>
```
Because descendants of `progressbar` are presentational, the following code is equivalent:
```html
<div role="progressbar">
<h3 role="presentation">Title of my progressbar</h3>
</div>
```
From the assistive technology user's perspective, the heading does not exist since the previous code snippets are equivalent to the following in the [accessibility tree](/en-US/docs/Glossary/Accessibility_tree):
```html
<div role="progressbar">Title of my progressbar</div>
```
### Associated WAI-ARIA roles, states, and properties
- [`aria-valuenow`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow)
- : Only present and required if the value is not indeterminate. Set to a decimal value between `0`, or `aria-valuemin` if present, and `aria-valuemax` indicating the current value of the progress bar.
- [`aria-valuetext`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext)
- : Assistive technologies often present the value of `aria-valuenow` as a percentage. If this would not be accurate use this property to make the progress bar value understandable.
- [`aria-valuemin`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin)
- : Set to a decimal value representing the minimum value, and less than `aria-valuemax`. If not present, the default value is `0`.
- [`aria-valuemax`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax)
- : Set to a decimal value representing the maximum value, and greater than `aria-valuemin`. If not present, the default value is `100`.
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) or [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : Defines the string value or identifies the element (or elements) that label the progressbar element providing an accessible name. An accessible name is required.
It is recommended to use a native {{HTMLElement("progress")}} or [`<input type="range">`](/en-US/docs/Web/HTML/Element/input/range) elements rather than the `progressbar` role. User agents provide a stylize widget for the {{HTMLElement("progress")}} element based on the current `value` as it relates to the `0`, the minimum value, and the `max` value. When using non-semantic elements, all features of the native semantic element need to be recreated with ARIA attributes, JavaScript and CSS.
## Examples
In the example below, the progress bar uses the default values of 0 and 100 for `aria-valuemin` and `aria-valuemax`:
```html
<div>
<span id="loadinglabel">Loading:</span>
<span role="progressbar" aria-labelledby="loadinglabel" aria-valuenow="23">
<svg width="100" height="10">
<rect height="10" width="100" stroke="black" fill="black" />
<rect height="10" width="23" fill="white" />
</svg>
</span>
</div>
```
Using semantic HTML, this could be written as:
```html
<label for="loadinglabel">Loading:</label>
<progress id="loadinglabel" max="100" value="23"></progress>
```
## Best Practices
If the progress bar is describing the loading progress of a particular region of a page, include the [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) attribute to reference the progress bar's status, and set the [`aria-busy`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy) attribute to `true` on the region until it is finished loading.
### Prefer HTML
It is recommended to use a native {{HTMLElement("progress")}} or [`<input type="range">`](/en-US/docs/Web/HTML/Element/input/range) elements rather than the `progressbar` role.
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement('progress')}} element
- Other range widgets include:
- [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role)
- [`scrollbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role) (if focusable)
- [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [`spinbutton`](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/tooltip_role/index.md | ---
title: "ARIA: tooltip role"
slug: Web/Accessibility/ARIA/Roles/tooltip_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#tooltip
---
A `tooltip` is a contextual text bubble that displays a description for an element that appears on pointer hover or keyboard focus.
## Description
Tooltips provide contextual information about an element when that owning element receives focus or is hovered over, but is otherwise not visible on the page. The tooltip is displayed automatically, after a brief delay; the user does not request it. While a tooltip can be placed on any content, they generally are tips for tools or controls, such as providing additional content for icons that have brief labels (or no labels at all, which is not accessible!).
A tooltip typically becomes visible, after a short delay of generally one to five seconds, in response to a mouse hover, or after the owning element receives keyboard focus. Just as it is opened automatically, without user request, it is closed automatically when the focus is lost or on mouse out. It must stay open when the mouse moves over the tooltip itself, and should also close when the user presses the <kbd>Escape</kbd> key.
Because the tooltip itself never receives focus and is not in the tabbing order, a tooltip can not contain interactive elements like links, inputs, or buttons.
The tooltip is not the appropriate role for the more information "i" icon, ⓘ. A tooltip is directly associated with the owning element. The ⓘ isn't 'described by' detailed information; the tool or control is.
The use of the ARIA `tooltip` role is a supplement to the normal browser tooltip behavior. An example of a native browser tooltip is the way some browsers display an element's [`title` attribute](/en-US/docs/Web/HTML/Global_attributes/title) on long mouse hover. One cannot activate this feature through either keyboard focus or through touch interaction, making this feature inaccessible. If the information is important enough to include as a tooltip or title, consider including it in visible text.
Elements with the `tooltip` role should be referenced through the use of [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) before or when the tooltip is displayed. The `aria-describedby` attribute is on the owning element, not on the tooltip.
The tooltip is not considered a popup in terms of the [`aria-haspopup`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup) property on the owning element, which is why we used "text bubble" in the introductory definition.
Though a tooltip may appear and disappear, as its appearance is automatic and not intentionally controlled by the user, the [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) role is not supported.
The accessible name of a tooltip can come from the contents. While, in theory, they could come from an [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) or [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby), in most cases, using ARIA properties to provide a tooltip with an accessible name is not recommended.
Tooltips provide additional information, generally with no direct interaction on the tooltip itself. They are generally associated with the content they're defining via an [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) with the `id` of the primary element. Therefore, if the tooltip has an accessible name explicitly set, that name is exposed as the primary element's description rather than the contents of the tooltip, meaning the tooltip contents may never be discovered by a screen reader user.
### Associated WAI-ARIA roles, states, and properties
- The element that serves as the tooltip container has `role="tooltip"` set.
- The element that triggers the tooltip references the tooltip element with [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby).
### Keyboard interactions
- <kbd>Escape</kbd>
- : Closes the tooltip
The tooltip should appear on focus or when the element is hovered on, without additional interaction. It should disappear automatically when the focus on the owning element is lost or the mouse is moved outside the owning element and the tooltip. While the tooltip does not receive focus, the <kbd>Escape</kbd> should close it if it is open.
### Required JavaScript features
- The tooltip is displayed and disappears via keyboard focus and removal of focus and by the mouse events - mousing over and mousing out.
- The tooltip never receives focus. Focus stays on the owning element.
- The tooltip can be hidden with the <kbd>Escape</kbd> key
- The tooltip stays open when hovered
- The tooltip is only hidden via JavaScript and CSS selectors. If JavaScript is not available the tooltip is shown.
## Examples
```html
<label for="password">Password:</label>
<input aria-describedby="passwordrules" id="password" type="password" />
<div role="tooltip" id="passwordrules">
<p>Password Rules:</p>
<ul>
<li>Minimum of 8 characters</li>
<li>
Include at least one lowercase letter, one uppercase letter, one number
and one special character
</li>
<li>Unique to this website</li>
</ul>
</div>
```
The tooltip can be instantiated with CSS. Change the class name with JavaScript to a class that hides the tooltip if the user hits the <kbd>Escape</kbd> key.
```css
[role="tooltip"],
.hidetooltip.hidetooltip.hidetooltip + [role="tooltip"] {
visibility: hidden;
position: absolute;
top: 2rem;
left: 2rem;
background: black;
color: white;
}
[aria-describedby]:hover,
[aria-describedby]:focus {
position: relative;
}
[aria-describedby]:hover + [role="tooltip"],
[aria-describedby]:focus + [role="tooltip"] {
visibility: visible;
}
```
The above hides the tooltip with CSS in the default state or if the hidetooltip class has been added with JavaScript (when the user hit <kbd>Escape</kbd>), with high specificity to ensure the tooltip doesn't show. When the owning element receives focus, it gets positioned relatively and the tooltip becomes visible.
## Accessibility concerns
If the information is important enough for a tooltip, isn't it important enough to always be visible?
The tooltip must stay open when hovered, even if that technically means the mouse moves out of the owning element. As content which appears on hover can be difficult or impossible to perceive if a user is required to keep their mouse pointer over the trigger, [WCAG 1.4.13](/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background) states that content made visible should be persistent, meaning it should not disappear without user action.
## Best Practices
Instead of using tooltips and hiding important information, consider writing clear, succinct, always visible descriptions. If you have space, don't use tooltips or toggletips. Just provide clear labels and sufficient body text.
## Specifications
{{Specifications}}
## See also
- [The `dialog` role](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role)
- [CSS: `:focus` pseudoclass](/en-US/docs/Web/CSS/:focus)
- [Tooltips & Toggletips](https://inclusive-components.design/tooltips-toggletips/) by Heydon Pickering
- [Understanding SC 1.4.13:Content on Hover or Focus (WCAG Level AA)](https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/timer_role/index.md | ---
title: "ARIA: timer role"
slug: Web/Accessibility/ARIA/Roles/timer_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#timer
---
The **`timer`** role indicates to assistive technologies that an element is a numerical counter listing the amount of elapsed time from a starting point or the remaining time until an end point. Assistive technologies will not announce updates to a timer as it has an implicit [aria-live](https://www.w3.org/TR/wai-aria/#aria-live) value of `off`.
```html
<div role="timer" id="eggtimer">0</div>
```
This defines this `div` element as a timer with no remaining time.
## Description
The `timer` role indicates to assistive technologies that this part of the web content is a live region containing a timer listing the time remaining or elapsed time. A timer's inner text should be an updating current time measurement. While the value does not necessarily need to be machine parsable, it should continuously update at regular intervals unless the timer is paused or reaches its end-point.
Along with [`alert`](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role), [`log`](/en-US/docs/Web/Accessibility/ARIA/Roles/log_role), [`marquee`](/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role), and [`status`](/en-US/docs/Web/Accessibility/ARIA/Roles/status_role) the `timer` role is a live region and can be modified by [live region](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) attributes.
### Associated WAI-ARIA roles, states, and properties
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) or [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : Some screen readers announce the name of a timer element before announcing its contents. If a name is visible, reference it using `aria-labelledby`. Including an `aria-label` provides a method for prefacing the visible content of a timer element with text that is not displayed when a screen reader reads the content. Naming a timer is not required so if nothing is appropriate both these attributes can be omitted.
- [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live)
- : Elements with the role `timer` have an implicit [aria-live](https://www.w3.org/TR/wai-aria/#aria-live) value of `off`.
## Accessibility concerns
If a time limit needs to be in place, for example, for security reasons, the user should have the option to turn it off or extend it. This restriction does not apply if the time limit is due to a live event, such as an auction or a game, or if the time to complete the form is essential for a valid submission.
## Specifications
{{Specifications}}
## See also
- [ARIA: `alert` role](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)
- [ARIA: `log` role](/en-US/docs/Web/Accessibility/ARIA/Roles/log_role)
- [ARIA: `marquee` role](/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role)
- [ARIA: `status` role](/en-US/docs/Web/Accessibility/ARIA/Roles/status_role)
- [ARIA live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)
- [`timer` example on Codepen](https://codepen.io/heydon/pres/NGgNjZ) by Heydon Pickering
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/treegrid_role/index.md | ---
title: "ARIA: treegrid role"
slug: Web/Accessibility/ARIA/Roles/treegrid_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#treegrid
- https://www.w3.org/WAI/ARIA/apg/patterns/treegrid/examples/treegrid-1/
---
The `treegrid` role identifies an element as being grid whose rows can be expanded and collapsed in the same manner as for a `tree`.
## Description
A `treegrid` is a hierarchical data grid, or table, consisting of tabular information that is editable or interactive. A `treegrid` is a combination of the [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role) and [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role) roles. Like a `grid`, the `treegrid` is made up of rows, columns, and gridcells. Like a `tree`, parent nodes in a `treegrid` are expandable and collapsible.
The `treegrid` widget contains one or more [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role) elements, optionally with [`rowgroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role) elements grouping the rows. Each row, in turn, contains one or more cells. Each cell is either a DOM descendant of or owned by a row element and is either a [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role), [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role), or [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role) element, with the `gridcell` role being used for all cells that do not contain column or row header information.
A `row` that can be expanded or collapsed to show or hide a set of child rows is a **parent row**. Each parent row has the [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) state set on either the row element or on a cell contained in the row.
The `aria-expanded` state is set to `true` when the child rows are displayed and set to `false` when the child rows are hidden. Elements that do not control display of child rows should not have the `aria-expanded` attribute because the presence of the attribute indicates to assistive technologies that the element with the attribute is a parent.
When your grid UI calls for rows supporting `aria-expanded` or if your grid requires supporting [`aria-posinset`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset), [`aria-setsize`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize), or [`aria-level`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level), use `treegrid` and not `grid`.
Each `row` or `gridcell` in a row should be keyboard focusable, and keyboard focus for all these tree grid descendants must be managed. The exception to this rule is column header cells which aren't required to be focusable if they do not provide functionality such as sort or filter. Every row and cell should either contain a focusable element or be focusable itself, regardless of whether individual cell content is editable or interactive.
### Single and multi-select treegrids
If the `treegrid` allows the user to choose just one item for an action, then it is known as a **single-select** treegrid. In single-select treegrids, the item with focus also has a selected state set with [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected).
If the treegrid supports selection of more than one row or cell, it is a **multi-select** treegrid. In the multi-select treegrid, the selected state is independent of the focus. The visual design and assistive technologies must distinguish between items that are selected and the item that has focus.
For multi-select treegrids, include [`aria-multiselectable="true"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable) on the element with the `treegrid` role. All selected rows or cells have [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) set to true. All rows and cells that are selectable but not currently selected have `aria-selected` set to `false`. Don't include the `aria-selected` attribute on rows and cells that are not individually selectable as the presence of the attribute indicates to assistive technologies that the row or cell is selectable.
### Orphan rows
In cases where a child `row` or `rowgroup` is not nested within the `treegrid` in the DOM, the [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns) attribute, referencing all of the IDs of the non-descendant children must be set on the `treegrid` element. If rows or cells are included in a treegrid via `aria-owns`, they will be presented to assistive technologies after the DOM descendants of the `treegrid` element unless the grid's actual DOM descendants are also included in the `aria-owns` attribute.
### Treegrids with dynamically loaded content
If some rows or columns are not in the DOM and are dynamically loaded when scrolling, [`aria-colcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colcount), [`aria-rowcount`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowcount), [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex) and [`aria-rowindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex) come into play. The `aria-colcount` and `aria-rowcount` properties get set on the `treegrid`. The values being the total number of columns and rows of the fully loaded grid, respectively. The indexes for each row and column get set on individual cells, not on the `treegrid` element.
### A treegrid's accessible name, description, and focus
The element with the role of `treegrid` must have an accessible name. If an appropriate label is visible in the content, provide the name via [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby). In other words, if there is an element in the user interface that serves as a label for the treegrid, include `aria-labelledby` as an attribute on the element with the role of `treegrid`, and set the value of the attribute to the `id` of the labelling element or elements. If no visible label is present, use [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) instead. Not both.
If the content includes a caption or description for the `treegrid`, include [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) on the `treegrid` element with the attribute value being the `id` of the element containing the description.
If the `treegrid` container itself receives focus, the value of its [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant) property should reference the [`id`](/en-US/docs/Web/HTML/Global_attributes#id) of the selected `row`, `columnheader`, `rowheader` or `gridcell`, unless roving tabindex is used to manage focus between those roles, in which case `aria-activedescendant` should not be used.
If the `treegrid` is disabled, make that disabled state visually apparent, programmatically enforced, and include the [`aria-disabled`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled) attribute on the `treegrid` itself to inform assistive technologies of its disabled state.
### Treegrid sorting
If the treegrid provides sort functions, the [`aria-sort`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-sort) attribute is included on relevant header cell elements, not on the grid itself.
### Treegrid menus
If the `treegrid` has an attached [`menu`](/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role) that opens when right clicked, include [`aria-haspopup="true"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup) on the `treegrid` element. This informs assistive technologies that the `treegrid` has an associated popup. The ability for both keyboard and pointer device users to open and set focus in the menu must be added with JavaScript.
### Read-only treegrids
By default, treegrids are assumed to be editable. If a tree grid is not editable, use the [`aria-readonly`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly) attribute to inform assistive technologies the `treegrid` is readonly. The attribute value, when set on the element with the `treegrid` role, propagates down to all `columnheader`, `rowheader`, and `gridcell` elements. That global value can be overridden for individual `gridcell` elements by including `aria-readonly` on individual tree grid element descendants.
Like all ARIA attributes, adding `aria-readonly` only informs assistive technologies that the content is or is not editable, but it does nothing to enable or disable interactivity. That must be done with HTML's global [`contenteditable`](/en-US/docs/Web/HTML/Global_attributes#contenteditable) attribute or with JavaScript.
### Associated WAI-ARIA roles, states, and properties
- [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role) role
- : A row of cells within a tabular structure, optionally within a `rowgroup`. Contains one or more rows of grid cells, column headers, or row headers.
- [`rowgroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role) role
- : A group of [rows](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role) within a tabular structure.
- [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role) role
- : Intended to mimic the functionality of the HTML {{HTMLElement('td')}} element, is found in `grid` and `treegrid` roles and must be the direct child of a `row`.
- [columnheader](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role) role
- : A cell in a row containing header information for a column, similar to the native {{HTMLElement('th')}} element with column scope
- [rowheader](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role) role
- : A cell containing header information for a `row` within a tabular structure.
- [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded)
- : For expandable items, the value is `true` or `false`. Also indicates that the item is expandable, so should not be present if the item cannot be expanded.
- [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns)
- : Identifies a contextual relationship between a parent and its child elements when the DOM hierarchy cannot be used to represent the relationship
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : Use this attribute to label the `treegrid`. The `aria-labelledby` attribute is generally the id of the element used to title the treegrid.
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- : A human-readable string value which identifies the `treegrid`. If there's a visible label, then `aria-labelledby` should be used instead.
### Keyboard interactions
Being able to move focus among rows and cells of the grid with a keyboard must be implemented in order to create an accessible treegrid. Moving focus into the grid may result in the first cell or the first row being focused. Whether focus goes to the next adjacent cell or the row depends on its content requirements, with some treegrids not providing focus to rows.
The following keyboard interactions need to be supported when an element in the grid has received focus, e.g., after a user has moved focus to the grid with Tab.
- <kbd>Enter</kbd>
- : If cell-only focus is enabled and focus is on the first cell with the `aria-expanded` property, opens or closes the child rows. Otherwise, performs the default action for the cell.
- <kbd>Tab</kbd>
- : If the row containing focus contains focusable elements such as an {{HTMLElement('input')}}, {{HTMLElement('button')}} or {{HTMLElement('a')}}, moves the focus to the next input in the row. If focus is on the last focusable element in the row, moves focus out of the treegrid widget to the next focusable element.
- <kbd>Right Arrow</kbd>
- : If focus is on a collapsed row, expand the row. If focus is on an expanded row or is on a row that does not have child rows, moves focus to the first cell in the row. If focus is on the right-most cell in a row, focus does not move. If focus is on any other cell, moves focus one cell to the right.
- <kbd>Left Arrow</kbd>
- : If focus is on an expanded row, collapses the row. If focus is on a collapsed row or on a row that does not have child rows, focus does not move. If focus is on the first cell in a row and row focus is supported, moves focus to the row. If focus is on the first cell in a row and row focus is not supported, focus does not move. If focus is on any other cell, moves focus one cell to the left.
- <kbd>Down Arrow</kbd>
- : If focus is on a row, moves focus one row down. If focus is on the last row, focus does not move. If focus is on a cell, moves focus one cell down. If focus is on the bottom cell in the column, focus does not move.
- <kbd>Up Arrow</kbd>
- : If focus is on a row, moves focus one row up. If focus is on the first row, focus does not move. If focus is on a cell, moves focus one cell up. If focus is on the top cell in the column, focus does not move.
- <kbd>Page Down</kbd>
- : If focus is on a row or cell, moves focus down a predetermined number of rows or cells. Usually, it moves down the equivalent of the height of the treegrid, scrolling so the bottom row in the currently visible set of rows becomes one of the first visible rows. If focus is in the last row, focus does not move.
- <kbd>Page Up</kbd>
- : If focus is on a row or cell, moves focus up an predetermined number of rows. Usually, it moves up the equivalent of the height of the treegrid, scrolling so the top row in the currently visible set of rows becomes one of the last visible rows. If focus is in the first row, focus does not move.
- <kbd>Home</kbd> <kbd>Control + Home</kbd>
- : If focus is on a row, moves focus to the first row. If focus is in the first row, focus does not move. If focus is on a cell, moves focus to the first cell in the row. If focus is in the first cell of the row, focus does not move.
- <kbd>End</kbd> <kbd>Control + End</kbd></td><td>
- : If focus is on a row, moves focus to the last row. If focus is in the last row, focus does not move. If focus is on a cell, moves focus to the last cell in the row. If focus is in the last cell of the row, focus does not move. If not all rows are present in the DOM, this can be used to focus on the last row present in the DOM, or on the last row available if the entire database were present in the DOM.
If a treegrid supports selection of cells, rows, or columns, the following keys are commonly used for these functions.
- <kbd>Control + Space</kbd>
- : If focus is on a row, selects all cells. If focus is on a cell, selects the column that contains the focus.
- <kbd>Shift + Space</kbd>
- : If focus is on a row, select the row. If focus is on a cell, select the row that contains the focus. If the treegrid includes a column with checkboxes for selecting rows, this key can also be used as a shortcut for checking the box when focus is not on the checkbox.
- <kbd>Control + A</kbd>
- : Selects all cells.
- <kbd>Shift + Right Arrow</kbd>
- : if focus is on a cell, extends selection one cell to the right.
- <kbd>Shift + Left Arrow</kbd>
- : if focus is on a cell, extends selection one cell to the left.
- <kbd>Shift + Down Arrow</kbd>
- : If focus is on a row, extends selection to all the cells in the next row. If focus is on a cell, extends selection one cell down.
- <kbd>Shift + Up Arrow</kbd>
- : If focus is on a row, extends selection to all the cells in the previous row. If focus is on a cell, extends selection one cell up.
If navigation functions can dynamically add more rows or columns to the DOM, key events that move focus to the beginning or end of the grid, such as <kbd>control + End</kbd>, may move focus to the last row in the DOM rather than the last available row in the back-end data.
While navigation keys, such as arrow keys, are moving focus from cell to cell, they are not available to do something like operate a combobox or move an editing caret inside of a cell. If this functionality is needed, see [Editing and Navigating Inside a Cell](https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside).
<!--
### Required JavaScript features
## Examples
-->
## Accessibility concerns
It is important for all cells to be able to receive or contain keyboard focus because screen readers are generally in application reading mode, rather than their document reading mode, when users are interacting with the grid. While in application mode, a screen reader user hears only focusable elements and content that labels focusable elements. If content can't receive focus, screen reader users may unknowingly overlook elements contained in the treegrid.
<!--
## Best Practices
### Prefer HTML
-->
## Specifications
{{Specifications}}
## See also
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/generic_role/index.md | ---
title: "ARIA: generic role"
slug: Web/Accessibility/ARIA/Roles/generic_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#generic
---
The `generic` role creates a nameless container element which has no semantic meaning on its own.
> **Note:** The `generic` role is the implicit role of generic elements used by user agents. It is included here for completeness of documentation. It should not be used by web authors.
## Description
While ARIA is primarily used to express semantics, there are some elements that shouldn't expose a semantic name to assistive technologies. The `generic` role indicates an element's role is equivalent to that of the non-semantic {{HTMLElement('div')}} and {{HTMLElement('span')}} elements.
The `generic` role is intended for use as the implicit role of generic elements in host languages for use by user agents only; not for use by developers. Instead, to remove implicit accessibility semantics, use [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) or `none`, the {{HTMLElement('div')}} and {{HTMLElement('span')}} elements that have no semantic meaning, or semantic container roles such as [`group`](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role) to semantically group descendants in a named container.
Like an element with role `presentation`, an element with `role="generic"` can provide a limited number of accessible states and properties for its descendants, such as [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) attributes. However, unlike elements with role `presentation`, `generic` elements are exposed in accessibility APIs so that assistive technologies can gather certain properties such as layout and bounds.
Because the generic role is nameless, the [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) and [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) attributes are prohibited. Because the role is generic, the [`aria-roledescription`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription) and [`aria-brailleroledescription`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-brailleroledescription) attributes are also prohibited.
> **Note:** The element with `role="generic"` should not have an accessible name or role description.
### Associated WAI-ARIA roles, states, and properties
None. If a global ARIA state and property is set, `generic` or `none` will be ignored, and the implicit role of the element will be used.
## Examples
This role is for use by user agents and not by developers. As such, no appropriate example exists.
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement('div')}} and {{HTMLElement('span')}} elements
- [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) roles such as
- [`group`](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role) role
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/section_role/index.md | ---
title: "ARIA: section role"
slug: Web/Accessibility/ARIA/Roles/section_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#section
---
The **`section` role**, an abstract role, is a superclass role for renderable structural containment components.
> **Note:** The `section` role is an [abstract role](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles). It is included here for completeness of documentation. It **should not be used** by web authors.
## Description
The structural `section` role is an abstract role for categorizing all the section subclass roles. The role must not be used. Some subclasses, like [`alert`](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role),
[`note`](/en-US/docs/Web/Accessibility/ARIA/Roles/note_role), and [`tooltip`](/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role) are useful, and can be used to add semantics when no semantic HTML elements quite fit the purpose of a component. Others, like [`code`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles), [`figure`](/en-US/docs/Web/Accessibility/ARIA/Roles/figure_role), and [`subscript`](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles), aren't necessary, as there are HTML element equivalents. In this case, {{HTMLElement('code')}} {{HTMLElement('figure')}} and {{HTMLElement('sub')}}, respectively.
## Best Practices
Do not use.
## Specifications
{{Specifications}}
## See also
- [ARIA: `structure` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structure_role)
- [ARIA: `alert` role](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)
- [ARIA: `associationlist` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `associationlistitemkey` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `associationlistitemvalue` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `blockquote` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `caption` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `cell` role](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
- [ARIA: `code` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `definition` role](/en-US/docs/Web/Accessibility/ARIA/Roles/definition_role)
- [ARIA: `deletion` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `emphasis` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `figure` role](/en-US/docs/Web/Accessibility/ARIA/Roles/figure_role)
- [ARIA: `group` role](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role)
- [ARIA: `img` role](/en-US/docs/Web/Accessibility/ARIA/Roles/img_role)
- [ARIA: `insertion` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `landmark` role](/en-US/docs/Web/Accessibility/ARIA/Roles/landmark_role)
- [ARIA: `list` role](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role)
- [ARIA: `listitem` role](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role)
- [ARIA: `log` role](/en-US/docs/Web/Accessibility/ARIA/Roles/log_role)
- [ARIA: `mark` role](/en-US/docs/Web/Accessibility/ARIA/Roles/mark_role)
- [ARIA: `marquee` role](/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role)
- [ARIA: `math` role](/en-US/docs/Web/Accessibility/ARIA/Roles/math_role)
- [ARIA: `note` role](/en-US/docs/Web/Accessibility/ARIA/Roles/note_role)
- [ARIA: `paragraph` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `status` role](/en-US/docs/Web/Accessibility/ARIA/Roles/status_role)
- [ARIA: `strong` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `subscript` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `suggestion` role](/en-US/docs/Web/Accessibility/ARIA/Roles/suggestion_role)
- [ARIA: `superscript` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `table` role](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role)
- [ARIA: `tabpanel` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tabpanel_role)
- [ARIA: `term` role](/en-US/docs/Web/Accessibility/ARIA/Roles/term_role)
- [ARIA: `time` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structural_roles)
- [ARIA: `tooltip` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/toolbar_role/index.md | ---
title: "ARIA: toolbar role"
slug: Web/Accessibility/ARIA/Roles/toolbar_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#toolbar
- https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/examples/toolbar/
---
The `toolbar` role defines the containing element as a collection of commonly used function buttons or controls represented in a compact visual form.
## Description
A toolbar is a collection of commonly used controls, such as buttons or checkboxes, grouped together in a compact visual form. The `toolbar` role can be used to communicate the presence and purpose of such a grouping to screen reader users and can help reduce the number of tab stops for keyboard users. Only use the `toolbar` role to group 3 or more controls.
The toolbar is commonly a subset of functions found in a `menubar` as a way to reduce user effort. If you have more than one toolbar in a menubar, each toolbar requires a label; which you can include with [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) or [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label).
When creating a toolbar, you need to implement focus management and keyboard interactions within the toolbar, handling when the same keyboard interactions is used both in the toolbar and in included native control. The <kbd>Left Arrow</kbd> and <kbd>Right Arrow</kbd> should be used to navigate between the controls within a horizontal tool bar. The <kbd>Up Arrow</kbd> and <kbd>Down Arrow</kbd> should be used if the toolbar is vertical — in which case you also want to include the `aria-orientation="vertical"` — or, in a horizontal toolbar, can be reserved for operating controls, such as spin buttons that require vertical arrow keys to operate.
Avoid including controls whose operation requires arrow keys used for toolbar navigation. If you must include such a control, make it the last control in the toolbar. For example, in a horizontal toolbar, a textbox could be included as the last element.
If any of the otherwise interactive elements within the toolbar are temporarily disabled, consider letting them remain focusable so screen reader users can be made aware of their presence.
### Associated WAI-ARIA roles, states, and properties
- [`aria-orientation`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation)
- : Elements with the role toolbar have an implicit `aria-orientation` value of horizontal.
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) / [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- : If the toolbar has a visible label, reference it by ID with the `aria-labelledby` attribute. Otherwise, provide an `aria-label`. If there is more than one toolbar in a menu, naming is required.
### Keyboard interactions
Implement focus management so the keyboard tab sequence includes one stop for the toolbar and arrow keys move focus among the controls in the toolbar.
- <kbd>Tab</kbd> and <kbd>Shift + Tab</kbd>
- : Move focus into and out of the toolbar. When focus moves into a toolbar:
- If focus is moving into the toolbar for the first time, focus is set on the first control that is not disabled.
- If the toolbar has previously contained focus, focus is optionally set on the control that last had focus. Otherwise, it is set on the first control that is not disabled.
- <kbd>Home</kbd> (Optional)
- : Moves focus to first element.
- <kbd>End</kbd> (Optional)
- : Moves focus to last element.
#### Horizontal toolbar
Elements with the role toolbar have an implicit `aria-orientation` value of horizontal. If the toolbar indeed has this orientation, the following keyboard interactions need to be implemented:
- <kbd>Left Arrow</kbd> (For a horizontal toolbar (the default)
- : Moves focus to the previous control. Optionally, focus movement may wrap from the first element to the last element.
- <kbd>Right Arrow</kbd> (For a horizontal toolbar (the default)
- : Moves focus to the next control. Optionally, focus movement may wrap from the last element to the first element.
In toolbars with multiple rows of controls, allow the left and right arrows to wraps from row to row, leaving the option of reserving vertical arrow keys for operating controls, such as navigating among radios buttons, or incrementing/decrementing a numeric spinner.
#### Vertical toolbar
If the toolbar is vertical, ensure `aria-orientation="vertical"` is set, and the following keyboard interactions are implemented:
- <kbd>Down Arrow</kbd> (For a horizontal toolbar (the default)
- : Moves focus to the previous control. Optionally, focus movement may wrap from the first element to the last element.
- <kbd>Up Arrow</kbd> (For a horizontal toolbar (the default)
- : Moves focus to the next control. Optionally, focus movement may wrap from the last element to the first element.
### Required JavaScript features
Implement focus management so the keyboard tab sequence includes one stop for the toolbar and arrow keys move focus among the controls in the toolbar. When tabbing into the toolbar, focus returns to the control that last had focus.
While the toolbar element itself does not receive focus, focus on movement into, out of, and within the toolbar has to be managed. On load, the first element in the tabbing sequence within the toolbar has `tabindex="0"` with `tabindex="-1"` set on all other focusable elements within the toolbar. Depending on the [keyboard interaction], the element receiving focus gets set to `tabindex="0"` and the element that just lost focus gets switched back to `tabindex="-1"`. Set focus, `element.focus()`, on the element that has `tabindex="0"`. This is called "roving tabindex". A benefit of using roving tabindex to manage focus is that the browser will scroll the newly focused element into view.
If the design calls for a specific element to be focused the next time the user moves focus into the toolbar with <kbd>Tab</kbd> or <kbd>Shift + Tab</kbd>, check if that target element has `tabindex="0"` when toolbar loses focus.
When the toolbar has focus within it, provide visual cues. When an element within the toolbar has focus, a visual cue must be included on both the toolbar itself - to help the toolbar supports directional navigation with the arrow keys - and the control that has focus. The CSS pseudoclasses of `:focus` and `:focus-within` can be used to target both elements.
## Examples
[Toolbar example from <abbr>W3C</abbr>, the World Wide Web Consortium](https://www.w3.org/TR/wai-aria-practices-1.2/examples/toolbar/toolbar.html)
## Accessibility concerns
Avoid including controls whose operation requires arrow keys used for toolbar navigation (right and left arrows, or top and bottom for vertical toolbars). If you must include such a control, make it the last control in the toolbar. For example, in a horizontal toolbar, a textbox could be included as the last element.
If any of the otherwise interactive elements within the toolbar are disabled, consider letting them remain focusable so screen reader users can be made aware of their presence.
## Specifications
{{Specifications}}
## See also
- [The CSS `:focus` pseudoclass](/en-US/docs/Web/CSS/:focus)
- [The CSS `:focus-within` pseudoclass](/en-US/docs/Web/CSS/:focus-within)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/link_role/index.md | ---
title: "ARIA: link role"
slug: Web/Accessibility/ARIA/Roles/link_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#link
---
A `link` widget provides an interactive reference to a resource. The target resource can be either external or local; i.e., either outside or within the current page or application.
> **Note:** Where possible, it is recommended that you use a native {{HTMLElement("a")}} element rather than the `link` role, as native elements are more widely supported by user agents and assistive technology. Native {{HTMLElement("a")}} elements also support keyboard and focus requirements by default, without need for additional customization.
## Description
The `link` role is used to identify an element that creates a hyperlink to a resource that is in the application or external.
When not using semantic HTML for its intended purpose, interactive features must be re-implemented. For example, when `role="link"` is added to an element, the <kbd>tab</kbd> key should enable giving focus to the link and the <kbd>enter</kbd> key should execute the link when focused.
Use the [`tabindex`](/en-US/docs/Web/HTML/Global_attributes#tabindex) attribute with a value of `0` to ensure the link is in the correct tab focus order.
> **Warning:** Applying the `link` role to an element will not cause browsers to enhance the element with standard link appearance or behaviors, such as underlining, focus rings, navigation to the link target, or context menu actions. That's the developer's responsibility.
## Examples
To recreate an accessible link using the `link` role on an element that is not an {{HTMLElement('a')}}, you need to ensure the link receives focus in the correct tab order, that the element looks like a link, and that the "link" behaves like a link.
```html
<span data-href="https://mozilla.org" tabindex="0" role="link">
Fake accessible link created using a span
</span>
```
### CSS
```css
span[role="link"] {
color: blue;
text-decoration: underline;
cursor: pointer;
}
span[role="link"]:hover,
span[role="link"]:active,
span[role="link"]:focus {
color: purple;
}
span[role="link"]:focus {
background-color: palegoldenrod;
outline: 1px dotted;
}
```
### JavaScript
```js
const fakeLinks = document.querySelectorAll('[role="link"]');
for (let i = 0; i < fakeLinks.length; i++) {
fakeLinks[i].addEventListener("click", navigateLink);
fakeLinks[i].addEventListener("keydown", navigateLink);
}
//handles clicks and keydowns on the link
function navigateLink(e) {
if (e.type === "click" || e.key === "Enter") {
const ref = e.target ?? e.srcElement;
if (ref) {
window.open(ref.getAttribute("data-href"), "_blank");
}
}
}
```
If the element with `role="link"` receives an <kbd>Enter</kbd> key event, this executes the link, going to the linked page or moving focus to the in page target.
Optionally, <kbd>Shift</kbd> + <kbd>F10</kbd> opens a context menu for the link.
## Best practices
The various widget roles are used to define common interactive patterns. Similar to the document-structure roles, some of these roles, including the `link` role, duplicate the semantics of native HTML elements that are well supported, and should not be used.
Avoid using `link`, which we've included for completeness. The {{HTMLElement('a')}} semantic equivalent with accessible interactivity is available and supported.
### Prefer HTML
Using the {{HTMLElement('a')}} instead.
> **Note:** There is no need to include `role="link"` on an HTML link as the `<a>`, by default, has that role already.
## Specifications
{{Specifications}}
## See also
- The {{HTMLElement('a')}} element
- The {{HTMLElement('button')}} element
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- [ARIA practices `link` role examples](https://www.w3.org/WAI/ARIA/apg/patterns/link/examples/link/)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/list_role/index.md | ---
title: "ARIA: list role"
slug: Web/Accessibility/ARIA/Roles/list_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#list
---
The ARIA `list` role can be used to identify a list of items. It is normally used in conjunction with the `listitem` role, which is used to identify a list item contained inside the list.
```html
<div role="list">
<div role="listitem">List item 1</div>
<div role="listitem">List item 2</div>
<div role="listitem">List item 3</div>
</div>
```
## Description
Any content that consists of an outer container with a list of elements inside it can be identified to assistive technologies using the `list` and `listitem` containers respectively. A `list` must have one or more `listitem` children, or, alternatively, have one or more `group`s as children, with each `group` having one or more `listitem`s as children.
There are no hard and fast rules about which elements you should use to mark up the list and list items, but you should make sure that the list items make sense in the context of a list, e.g. a shopping list, recipe steps, driving directions.
> **Note:** Best practices dictate using the appropriate semantic HTML elements over ARIA roles to mark up lists and listitems — {{HTMLElement("ul")}}, {{HTMLElement("ol")}} and {{HTMLElement("li")}}. See [Best practices](#best_practices) for a full example.
### Associated WAI-ARIA Roles, States, and Properties
- [`listitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role) role
- : A single item in a list or directory. Elements with role listitem can only be found in an element with the role `list` or `group`.
- [`group`](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role) role
- : A collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a page's table of contents.
## Best practices
Only use `role="list"` and `role="listitem"` if you have to — for example if you don't have control over your HTML but are able to improve accessibility dynamically after the fact with JavaScript.
Unlike the HTML {{HTMLElement("ol")}} and {{HTMLElement("ul")}}, the ARIA `list` roles doesn't distinguish between ordered and unordered lists. If at all possible, you should use the appropriate semantic HTML elements to mark up a list ({{HTMLElement("ol")}} and {{HTMLElement("ul")}}) and list items ({{HTMLElement("li")}}). For example, our above example should be rewritten as follows:
```html
<ul>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ul>
```
or use an ordered list if the order of the list items matters:
```html
<ol>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ol>
```
> **Note:** The ARIA `list` / `listitem` roles don't distinguish between ordered and unordered lists.
As an aside, note that if you are using the semantic HTML elements of `<ol>` or `<ul>` and apply a role of [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role), each child `<li>` element inherits the `presentation` role because ARIA requires the `listitem` elements to have the parent `list` element. So, the `<li>` elements are not exposed to assistive technologies, but elements contained inside of those `<li>` elements, including nested lists, are visible to assistive technologies.
> **Note:** If you are marking up a list of items that will function as a tabbed interface, you should instead use the [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role), [`tabpanel`](/en-US/docs/Web/Accessibility/ARIA/Roles/tabpanel_role), and [`tablist`](/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role) roles.
## Specifications
{{Specifications}}
## See also
- The {{HTMLElement("ul")}} element
- The {{HTMLElement("ol")}} element
- The {{HTMLElement("li")}} element
- [ARIA: listitem role](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role)
- [ARIA: group role](/en-US/docs/Web/Accessibility/ARIA/Roles/group_role)
- [ARIA Lists examples](https://www.scottohara.me/blog/2018/05/26/aria-lists.html) — by Scott O'Hara
- [Accessibility Object Model](https://wicg.github.io/aom/spec/)
- [ARIA in HTML](https://w3c.github.io/html-aria/)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/searchbox_role/index.md | ---
title: "ARIA: searchbox role"
slug: Web/Accessibility/ARIA/Roles/searchbox_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#searchbox
---
The `searchbox` role indicates an element is a type of `textbox` intended for specifying search criteria.
## Description
The `searchbox` can be used instead of [`textbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role) when the text box is within an element with role [`search`](/en-US/docs/Web/Accessibility/ARIA/Roles/search_role). A `searchbox` is the semantic equivalent is HTML's {{HTMLElement('input')}} of type `search`, [`<input type="search">`](/en-US/docs/Web/HTML/Element/input/search), which should be used instead if possible.
The `searchbox` must have an accessible name. If the `searchbox` role is applied to an HTML {{HTMLElement('input')}} element, an associated {{HTMLElement('label')}} should be used.
Otherwise, use [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) if a visible label is present, or [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) if a visible label is not present.
The screen reader will announce "search box", "search edit", or "search field" plus the accessible name. This can be redundant if "search" is included in the label.
## Examples
```html
<div tabindex="0" aria-label="search" role="searchbox" contenteditable></div>
```
While the above is valid, it is simpler, more concise, and less redundant to the screen reader user to write:
```html
<input type="search" />
```
The following is a search form with a searchbox and button, ARIA live region, and container for search results.
```html
<form role="search">
<input
type="search"
role="searchbox"
aria-description="search results will appear below"
id="search"
value="" />
<label for="search">Search this site</label>
<button>Submit search</button>
</form>
<div aria-live="polite" role="region" aria-atomic="true">
<div class="sr-only"></div>
</div>
<div id="search-results"></div>
```
Including `role="searchbox"` when the form is a `search` and the label indicates the element is a search may result in assistive technology announcing something along the lines of "search search this site search box", which is redundant. The inclusion of `role="searchbox"` is not necessary:
```html
<input
type="search"
aria-description="search results will appear below"
id="search"
value="" />
```
## Specifications
{{Specifications}}
## See also
- [`<input type="search">`](/en-US/docs/Web/HTML/Element/input/search)
- [ARIA: `search` role](/en-US/docs/Web/Accessibility/ARIA/Roles/search_role)
- [ARIA: `textbox` role](/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/tablist_role/index.md | ---
title: "ARIA: tablist role"
slug: Web/Accessibility/ARIA/Roles/tablist_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#tablist
---
The `tablist` role identifies the element that serves as the container for a set of `tabs`. The tab content are referred to as `tabpanel` elements.
## Description
You may be interacting with a tabbed interface as you read this! Browser tabs allow a user have multiple web pages open in a single window. Clicking on a tab in the tablist at the top of the browser window enables the user to display the associated content in the main content area, the tabpanel, one site at a time. This is called a "tab design pattern".
When implementing a tab design pattern, the [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role), `tablist` and [`tabpanel`](/en-US/docs/Web/Accessibility/ARIA/Roles/tabpanel_role) roles are used.
Tabs are a set of layered sections of content, known as tab panels, that display one panel of content at a time. Each tab panel has an associated `tab` element, that, when activated, displays the panel. The list of tab elements is arranged along one edge of the currently displayed panel, most commonly the top edge, nested in a `tablist` element.
Each `tab` in a `tablist` serves as a label for one `tabpanel` and can be activated to display that panel. The `tablist` is the containing element for the set of tab elements contained.
When a tabbed interface is initialized, one tab panel is displayed and its associated tab is styled to indicate that it is active. When the user activates one of the other tab elements, the previously displayed tab panel is hidden, the tab panel associated with the activated tab becomes visible, and the tab is considered "active".
For a single-selectable tablist, the non-active tabpanel elements should be hidden from the user until the user selects the tab associated with that tabpanel.
When creating a multi-selectable tablist, include [`aria-multiselectable="true"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable) on the `tablist element`.
The `tab` elements not the `tablist`, have the [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) attribute. Set to `aria-selected="true"` for the tabs associated with each visible tabpanel. The tabs associated with hidden tabpanel elements have their `aria-selected` attributes set to `false`.
If the tab list has a visible label, set [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) to the `id` of the labelling element. If not, use [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) to provide a label.
To be keyboard accessible, focus must be managed for the descendants of this role.
Elements with the `tablist` role have an implicit [`aria-orientation`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation) value of `horizontal`.
### Associated WAI-ARIA roles, states, and properties
- [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) role
- : Required Owned Elements. Every tablist must have one or more `tab` children.
- [`aria-multiselectable`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable)
- : When set to `true`, indicates the user may select more than one `tab` from the `tablist` descendants.
- [`aria-orientation`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation)
- : If the tablist element is vertically oriented, set `aria-orientation="vertical"`. The default is `horizontal`.
### Keyboard interactions
For the tab list:
- <kbd>Tab</kbd>
- : When focus moves into the tab list, places focus on the active `tab` element. <br/><br/>When the tab list contains the focus, moves focus to the next element in the page tab sequence outside the tablist, which is the tabpanel unless the first element containing meaningful content inside the tabpanel is focusable.
When focus is on a tab element in a horizontal tab list:
- <kbd>Left Arrow</kbd>
- : moves focus to the previous tab. If focus is on the first tab, moves focus to the last tab. Optionally, activates the newly focused tab
- <kbd>Right Arrow</kbd>
- : Moves focus to the next tab. If focus is on the last tab element, moves focus to the first tab. Optionally, activates the newly focused tab
When focus is on a tab element in a vertical tab list:
- <kbd>Up Arrow</kbd>
- : moves focus to the previous tab. If focus is on the first tab, moves focus to the last tab. Optionally, activates the newly focused tab
- <kbd>Down Arrow</kbd>
- : Moves focus to the next tab. If focus is on the last tab element, moves focus to the first tab. Optionally, activates the newly focused tab
If the tab list is horizontal, it does not listen for <kbd>Down Arrow</kbd> or <kbd>Up Arrow</kbd> so those keys can provide their normal browser scrolling functions even when focus is inside the tab list.
When focus is on a tab in a tablist with either horizontal or vertical orientation:
- <kbd>Space</kbd> or <kbd>Enter</kbd>
- : Activates the tab if it was not activated automatically on focus.
- <kbd>Home</kbd> (Optional)
- : Moves focus to the first tab. Optionally, activates the newly focused tab
- <kbd>End</kbd> (Optional)
- : Moves focus to the last tab. Optionally, activates the newly focused tab
- <kbd>Shift + F10</kbd>
- : If the tab has an associated popup menu, opens the menu.
- <kbd>Delete</kbd> (Optional)
- : If deletion is allowed, deletes (closes) the current tab element and its associated tab panel, sets focus on the tab following the tab that was closed, and optionally activates the newly focused tab. If there is not a tab that followed the tab that was deleted, e.g., the deleted tab was the right-most tab in a left-to-right horizontal tab list, sets focus on and optionally activates the tab that preceded the deleted tab. If the application allows all tabs to be deleted, and the user deletes the last remaining tab in the tab list, the application moves focus to another element that provides a logical work flow. As an alternative to Delete, or in addition to supporting Delete, the delete function is available in a context menu.
<!--
### Required JavaScript features
## Accessibility concerns
## Best Practices
### Prefer HTML
-->
## Examples
See the [`tabpanel`, `tab`, and `tablist` example](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role#example) in the [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role) role definition.
## Specifications
{{Specifications}}
## See also
- [`tab` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
- [`tabpanel` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tabpanel_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/none_role/index.md | ---
title: "ARIA: none role"
slug: Web/Accessibility/ARIA/Roles/none_role
page-type: aria-role
---
The `none` role is a synonym for the [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) role; they both remove an element's implicit ARIA semantics from being exposed to the accessibility tree.
See the [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) role for more information.
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/group_role/index.md | ---
title: "ARIA: group role"
slug: Web/Accessibility/ARIA/Roles/group_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#group
---
The `group` role identifies a set of user interface objects that is not intended to be included in a page summary or table of contents by assistive technologies.
## Description
Most closely related to HTML's {{HTMLElement('fieldset')}} element, the `group` document structure role is used to identify a set of user interface objects which, as compared to [`region`](/en-US/docs/Web/Accessibility/ARIA/Roles/region_role), is not intended to be included in the page's summary or table of contents.
The `group` role should be used to form a logical collection of items with related functionality, such as children in a [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role) widget forming a collection of siblings in a hierarchy, or a collection of items having the same container in a [`directory`](/en-US/docs/Web/Accessibility/ARIA/Roles/directory_role).
When a `group` is used in the context of [`list`](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role), limit the children of the `group` to [`listitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role) elements. In this case, it is recommended to use multiple ordered or unordered lists, {{HTMLElement('ol')}} or {{HTMLElement('ul')}}, with nested {{HTMLElement('li')}} children.
When used in the context of a [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role), the only children allowed are {{HTMLElement('option')}} elements. In this case, it is recommended to use {{HTMLElement('select')}}, {{HTMLElement('option')}} and {{HTMLElement('optgroup')}} instead.
`Group` elements may be nested.
The `group` role should not be used for major perceivable sections of a page. If a section is significant enough that it should be included in the page's table of contents, use the `region` role or a standard [landmark role](/en-US/docs/Web/Accessibility/ARIA/Roles#3._landmark_roles).
When the role is added to an element, the browser will send out an accessible group event to assistive technology products, which can then notify the user about it.
## Examples
The HTML code example below uses the `group` role with a `tree` view:
```html
<div id="tree1" role="tree" tabindex="-1">
<div
id="animals"
class="groupHeader"
role="presentation"
aria-owns="animalGroup"
aria-expanded="true">
<img role="presentation" tabindex="-1" src="images/treeExpanded.gif" />
<span role="treeitem" tabindex="0">Animals</span>
</div>
<div id="animalGroup" role="group">
<div id="birds" role="treeitem">
<span tabindex="-1">Birds</span>
</div>
<div
id="cats"
class="groupHeader"
role="presentation"
aria-owns="catGroup"
aria-expanded="false">
<img role="presentation" tabindex="-1" src="images/treeContracted.gif" />
<span role="treeitem" tabindex="0">Cats</span>
</div>
<div id="catGroup" role="group">
<div id="siamese" role="treeitem">
<span tabindex="-1">Siamese</span>
</div>
<div id="tabby" role="treeitem">
<span tabindex="-1">Tabby</span>
</div>
</div>
</div>
</div>
```
The following example uses the `group` role with a drop-down [`menu`](/en-US/docs/Web/Accessibility/ARIA/Roles/menu_role) containing [`menuitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role)s:
```html
<div role="menu">
<ul role="group">
<li role="menuitem">Inbox</li>
<li role="menuitem">Archive</li>
<li role="menuitem">Trash</li>
</ul>
<ul role="group">
<li role="menuitem">Custom Folder 1</li>
<li role="menuitem">Custom Folder 2</li>
<li role="menuitem">Custom Folder 3</li>
</ul>
<ul role="group">
<li role="menuitem">New Folder</li>
</ul>
</div>
```
This menu could be constructed using {{HTMLElement('select')}} and {{HTMLElement('option')}} elements. In this case, the `group` role would be most similar to the {{HTMLElement('optgroup')}} element.
## Specifications
{{Specifications}}
## See also
- The {{HTMLElement('fieldset')}} Element
- [ARIA: `section` role](/en-US/docs/Web/Accessibility/ARIA/Roles/section_role)
- [ARIA: `row` role](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- [ARIA: `select` role](/en-US/docs/Web/Accessibility/ARIA/Roles/select_role)
- [ARIA: `toolbar` role](/en-US/docs/Web/Accessibility/ARIA/Roles/toolbar_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/presentation_role/index.md | ---
title: "ARIA: presentation role"
slug: Web/Accessibility/ARIA/Roles/presentation_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#presentation
---
The `presentation` role and its synonym `none` remove an element's implicit ARIA semantics from being exposed to the accessibility tree.
The content of the element will still be available to assistive technologies; it is only the semantics of the container — and in some instance, required associated descendants — which will no longer expose their mappings to the accessibility API.
## Description
While ARIA is primarily used to express semantics, there are some situations where hiding an element's semantics from assistive technologies is helpful. This is done with the `presentation` role or its synonym role `none`, which declare that an element is being used only for presentation and therefore does not have any accessibility semantics.
Writing `<h2 role="presentation">Democracy Dies in Darkness</h2>` removes the heading semantics of the {{HTMLElement("Heading_Elements", "h2")}} element, making it the equivalent of `<div>Democracy Dies in Darkness</div>`. The heading role semantics are removed, but the content itself is still available.
When an element has required descendants, such as the various {{HTMLElement('table')}}, elements and {{HTMLElement('li')}}s children of a {{HTMLElement('ul')}} or {{HTMLElement('ol')}}, the `presentation` or `none` role on the table or list removes the default semantics of the element on which it was applied and their required descendant elements.
If `presentation` or `none` is applied to a {{HTMLElement('table')}} element, the descendant {{HTMLElement('caption')}}, {{HTMLElement('thead')}}, {{HTMLElement('tbody')}}, {{HTMLElement('tfoot')}}, {{HTMLElement('tr')}}, {{HTMLElement('th')}}, and {{HTMLElement('td')}} elements inherit the role and are thus not exposed to assistive technologies. But, elements inside of the {{HTMLElement('th')}} and {{HTMLElement('td')}} elements, including nested tables, are exposed to assistive technologies.
```html
<ul role="presentation">
<li>
<a href="#">Link 1</a>
</li>
<li>
<a href="#">Link 2</a>
</li>
<li>
<a href="#">Link 3</a>
</li>
</ul>
```
Because the `presentation` role was applied to the {{HTMLElement('ul')}} element, every child {{HTMLElement('li')}} element inherits the `presentation` role. This is because ARIA requires the `listitem` elements to have a parent `list` element. While the {{HTMLElement('li')}} elements, in this case, are not exposed to assistive technologies, descendants of those required elements are exposed. If we had nested a list within one of those {{HTMLElement('li')}}'s, they would be visible to assistive technologies. For elements with no required children, any elements nested inside the element with `role="presentation"` or `role="none"` preserve their semantics. In this case, the {{HTMLElement('a')}} elements contained inside of those {{HTMLElement('li')}} elements are exposed.
The {{HTMLElement('a')}} is a special case. Its role would have been exposed even if it had the `presentation` or `none` role directly applied to it. Browsers ignore `role="presentation"` and `role="none"`on focusable elements, including link and inputs, or anything with a [tabindex](/en-US/docs/Web/HTML/Global_attributes/tabindex) attribute set. Browsers also ignore the inclusion of the role if any of the element contains any global ARIA states and properties, such as [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby).
> **Note:** The element with `role="presentation"` is not part of the accessibility tree and should not have an accessible name. Do **not** use [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) or [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label).
### Associated WAI-ARIA roles, states, and properties
None. If a global ARIA state and property is set, `presentation` or `none` will be ignored, and the implicit role of the element will be used.
## Examples
```html
<hr role="none" />
```
## Specifications
{{Specifications}}
## See also
- [`aria-hidden`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden) versus [`role="presentation/none"`](https://www.scottohara.me/blog/2018/05/05/hidden-vs-none.html) - by Scott O'Hara
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/option_role/index.md | ---
title: "ARIA: option role"
slug: Web/Accessibility/ARIA/Roles/option_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#option
- https://www.w3.org/WAI/ARIA/apg/patterns/listbox/examples/listbox-scrollable/
---
The `option` role is used for selectable items in a `listbox`.
## Description
The `option` role is used to identify selections a user can make in a [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role). These options are similar to the {{HTMLElement('option')}} elements in a {{HTMLElement('select')}} element, but they can contain images.
All selectable options should have [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) match their state, `true` when selected and `false` when not. If an option is not selectable, `aria-selected` can be omitted. A disabled option can have [`aria-disabled="true"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled) and `aria-selected="false"` to communicate to the user that the option is present, albeit disabled.
The `option` role is for identifying selectable choices of a `listbox`. Options must be provided an accessible name. Generally, the accessible name for an option should come from the element's descendant content.
Authors can also explicitly provide an accessible name by specifying [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) or [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) to the element with the `option` role. If using `aria-label` or `aria-labelledby`, and the option also displays a visible text label, authors must ensure they adhere to <a href="https://www.w3.org/WAI/WCAG21/Understanding/label-in-name.html">WCAG Success Criterion 2.5.3 Label in Name</a>.
It is highly recommended to use a {{HTMLElement('select')}} element or an {{HTMLElement('input')}} element with the `checkbox` or `radio` type instead, when possible. These native HTML elements provide keyboard interactivity to manage focus for all the descendants for you automatically.
### All descendants are presentational
There are some types of user interface components that, when represented in a platform accessibility API, can only contain text. Accessibility APIs do not have a way of representing semantic elements contained in a `option`. To deal with this limitation, browsers, automatically apply role [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) to all descendant elements of any `option` element as it is a role that does not support semantic children.
For example, consider the following `option` element, which contains a heading.
```html
<div role="option"><h3>Title of my option</h3></div>
```
Because descendants of `option` are presentational, the following code is equivalent:
```html
<div role="option"><h3 role="presentation">Title of my option</h3></div>
```
From the assistive technology user's perspective, the heading does not exist since the previous code snippets are equivalent to the following in the [accessibility tree](/en-US/docs/Glossary/Accessibility_tree):
```html
<div role="option">Title of my option</div>
```
### Associated ARIA roles, states, and properties
#### Associated Roles
- [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- : An `option` _must_ be contained in or owned by a `listbox`
#### States and Properties
- [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected)
- : Used to describe the selection state of the option. Required.
- [`aria-checked`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked)
- : Used to describe the checked state when options are used in a multiple selection fashion. Supports `true`, `false` and `mixed`. Optional.
- [`aria-posinset`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset)
- : Used to describe the position in the set of options when it does not match the DOM, such as virtual scrolling where only some options are present at a time. Optional.
- [`aria-setsize`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize)
- : Used in conjunction with `aria-posinset` to declare the total number of options. Optional.
- [`aria-disabled`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled)
- : Used to indicate that the option is present but not editable. Optional.
- [`aria-hidden`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden)
- : Used to hide the option from accessibility tools. It should only be used to hide non-visible content or visible content if it improves the experience of assistive technology, such as redundant content. Optional.
- [`aria-invalid`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid)
- : Used to indicate that the value of the option is considered invalid by the application. Optional.
- [`aria-busy`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy)
- : Used to indicate that an element is being modified, such as while it is loading. Optional.
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : Used to indicate which element labels the option. The content of the option should be used instead where appropriate. Optional.
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- : Used to label the option. If the label is present in the DOM, `aria-labelledby` should be used instead. Optional.
(For further details and a full list of ARIA states and properties see the <a href="https://www.w3.org/TR/wai-aria-1.1/#option">ARIA `option` (role)</a> documentation.)
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement('select')}} element
- HTML {{HTMLElement('label')}} element
- HTML {{HTMLElement('option')}} element
- [ARIA: `combobox` role](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [ARIA: `list` role](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role)
- [ARIA: `listbox` role](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/separator_role/index.md | ---
title: "ARIA: separator role"
slug: Web/Accessibility/ARIA/Roles/separator_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#separator
- https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-editor/
---
The `separator` role indicates the element is a divider that separates and distinguishes sections of content or groups of menuitems. The implicit ARIA role the native thematic break {{HTMLElement('hr')}} element is `separator`.
## Description
A separator is a divider that separates and distinguishes sections of content or groups of menuitems. There are two types of separators: a static structure that provides a visible boundary, identical to the HTML {{HTMLElement('hr')}} element, and a focusable, moveable widget.
Elements with the role `separator` have an implicit [`aria-orientation`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation) value of `horizontal`.
### Non-focusable separator
A non-focusable separator is a static structural element that can be used to help visually divide two groups of menu items in a menu or to provide a horizontal rule between two sections of a page. Thematic breaks that aren't focusable can still be perceivable by a screen reader user when using a reading cursor that does not depend on focus.
```html
<h2>My first blog post</h2>
…
<img src="blueline.gif" role="separator" alt="" />
<h2>Two years later, my second post</h2>
…
```
In the example, an image creates a visual separator between two blog posts. The author could have used a semantic thematic break {{HTMLElement('hr')}} element and styled it with CSS to make it blue (and not have to change the image when they change the blog's theme), or the author could have encompassed each post in the semantic {{HTMLElement('article')}} element, or both.
```html
<section role="feed">
<article>
<h2>My first blog post</h2>
…
</article>
<hr />
<article>
<h2>Two years later, my second post</h2>
…
</article>
</section>
```
```css
[role="feed"] > hr {
height: 3px;
background-color: blue;
}
```
An accessible name is not needed.
### Focusable separator
The separator role can be used to identify the element as a visual separator between groups of items within a menu, such as groups of `menuitemradio` or `menuitemcheckbox` elements.
If the separator is focusable, providing a visible boundary between two sections of content and enabling the user to change the relative size of the sections it separates by changing its position, the value of [`aria-valuenow`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow) must be set to a number reflecting the current position of the separator and the value must be updated when it changes. The [`aria-valuemin`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin) and [`aria-valuemax`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax) should also be included if they aren't set to the default values of 0 and 100, respectively.
An accessible name, with [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) should be included if there is more than one focusable separator.
### All descendants are presentational
There are some types of user interface components that, when represented in a platform accessibility API, can only contain text. Accessibility APIs do not have a way of representing semantic elements contained in a `separator`. To deal with this limitation, browsers, automatically apply role [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) to all descendant elements of any `separator` element as it is a role that does not support semantic children.
For example, consider the following `separator` element, which contains a heading.
```html
<div role="separator"><h3>Title of my separator</h3></div>
```
Because descendants of `separator` are presentational, the following code is equivalent:
```html
<div role="separator"><h3 role="presentation">Title of my separator</h3></div>
```
From the assistive technology user's perspective, the heading does not exist since the previous code snippets are equivalent to the following in the [accessibility tree](/en-US/docs/Glossary/Accessibility_tree):
```html
<div role="separator">Title of my separator</div>
```
### Associated WAI-ARIA roles, states, and properties
- [`aria-orientation`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation) (default is horizontal for separator)
- : By default, the divider for `separator` roles is assumed to be horizontal. The value can be included and set to horizontal, undefined (the default for other roles unless otherwise specified), or vertical.
- [`aria-valuenow`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow)
- : If the separator is focusable and has a known value, the `aria-valuenow` defines the current value. If not focusable or the value is unknown, do not include this attribute.
- [`aria-valuemin`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin) (default is 0)
- : If the separator is focusable, and the minimum value is not 0, include the minimum value with `aria-valuemin`. If the
- [`aria-valuemax`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax) (default is 100)
- : If the separator is focusable, and the maximum value is not 100, include `aria-valuemax` with a value equal to or larger than `aria-valuemin`.
- [`aria-valuetext`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext)
- : If the separator is focusable, and the `aria-valuenow` is not optimal in providing the user with usable information, included `aria-valuetext` content will be read instead of the `aria-valuenow` value.
<!--
### Keyboard interactions
### Required JavaScript features
## Examples
## Accessibility concerns
## Best Practices
### Prefer HTML -->
## Specifications
{{Specifications}}
## See also
- Thematic break HTML {{HTMLElement('hr')}} element
- [Example separator in a menubar](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-editor/)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/row_role/index.md | ---
title: "ARIA: row role"
slug: Web/Accessibility/ARIA/Roles/row_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#row
- https://www.w3.org/WAI/ARIA/apg/patterns/table/examples/table/
---
An element with `role="row"` is a row of cells within a tabular structure. A row contains one or more cells, grid cells or column headers, and possibly a row header, within a [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role), [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role) or [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role), and optionally within a [`rowgroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role).
```html
<div
role="table"
aria-label="Populations"
aria-describedby="country_population_desc">
<div id="country_population_desc">World Populations by Country</div>
<div role="rowgroup">
<div role="row">
<span role="columnheader" aria-sort="descending">Country</span>
<span role="columnheader" aria-sort="none">Population</span>
</div>
</div>
<div role="rowgroup">
<div role="row">
<span role="cell">Finland</span>
<span role="cell">5.5 million</span>
</div>
<div role="row">
<span role="cell">France</span>
<span role="cell">67 million</span>
</div>
</div>
</div>
```
## Description
The element `role="row"` is a row within a [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role), [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role) or [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role), and optionally within a [`rowgroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role), that is a container for one or more [`cells`](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role), [`gridcells`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role), [`columnheaders`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role), or [`rowheaders`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role) within a static tabular structure. Using native [HTML `<tr>`](/en-US/docs/Web/HTML/Element/tr) elements, whenever possible, is strongly encouraged.
To create an ARIA row, add `role="row"` to the container element. That row should be nested within a grid, table or treegrid. A group of rows can be nested within a grid, table or treegrid directly, or within a rowgroup in one of those containers. Each row contains child cells. These cells can be of different types, depending on whether they are column or row headers, or grid or regular cells.
A row can contain a number of attributes clarifying the row's role, including [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex), [`aria-level`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level), [`aria-rowindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex), and [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected).
If the row is within a treegrid, rows can include the [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) attribute, using the attribute to indicate the present status. This is not the case for an ordinary table or grid, in which the `aria-expanded` attribute is not present.
To create an interactive widget that has a tabular structure, use the grid pattern instead. If the interaction provides for the selection state of individual cells, if left to right and top to bottom navigation is provided, or if the user interface allows the rearranging of cell order or otherwise changing individual cell order such as through drag and drop, use [grid](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role) or [treegrid](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role) instead.
> **Note:** Using the native HTML table element ({{HTMLElement('table')}}) along with the table row element ({{HTMLElement('tr')}}) whenever possible is strongly encouraged.
### Associated WAI-ARIA roles, states, and properties
#### Context roles
- [role="rowgroup"](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role)
- : An optional contextual row parent, it establishes a relationship between descendant rows. It is a structural equivalent to the thead, tfoot, and tbody elements in an HTML table element.
- [role="table"](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role)
- : One of the three possible contexts (along with grid and treegrid) in which you'll find a row, it identifies the row as being part of a non-interactive table structure containing data arranged in rows and columns, similar to the native {{HTMLElement('table')}} HTML element.
- [role="grid"](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role)
- : One of the three possible contexts (along with table and treegrid) in which you'll find a row, it identifies the row as being part of a non-interactive table structure containing data arranged in rows and columns, similar to the native {{HTMLElement('table')}} HTML element.
- [role="treegrid"](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
- : Similar to a grid, but with rows that can be expanded and collapsed in the same manner as for a tree.
#### Descendant roles
- [role="cell"](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
- : A cell in a row within a tabular container.
- [role="gridcell"](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- : A cell in a row within a grid or treegrid.
- [role="columnheader"](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- : A header cell that is the structural equivalent of the HTML {{HTMLElement('th')}} element with a column scope ({{HTMLElement('tr', '<code><tr scope="col"></code>')}}). Unlike a plain cell, the columnheader role establishes a relationship between it and all cells in the corresponding column.
- [role="rowheader"](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- : A header cell that is the structural equivalent of the HTML {{HTMLElement('th')}} element with a row scope ({{HTMLElement('tr', '<code><tr scope="row"></code>')}}). Unlike a plain cell, the rowheader role establishes a relationship between it and all cells in the corresponding row.
#### States and properties
- [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) state
- : The `aria-expanded` attribute, which defines the state of the row, can take one of three values, or be omitted:
- `aria-expanded="true`: Row is currently expanded.
- `aria-expanded="false"`: Row is currently collapsed.
- `aria-expanded="undefined"` or the attribute is missing: The row is neither expandable nor collapsible.
If the element with the `aria-expanded` attribute controls the expansion of another grouping container that is not 'owned by' the element, the author **should** reference the container by using the `aria-controls` attribute.
- [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) state
- : Only relevant if the row is in an interactive container, such as a grid or treegrid, but not relevant if the row is in a table. The `aria-selected` attribute can take one of three values, or be omitted:
- `aria-selected="true`: Row is currently selected
- `aria-selected="false"`: Row is not currently selected.
- `aria-selected="undefined"` or the attribute is missing: The row is not selectable.
- [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex) attribute
- : The `aria-colindex` attribute is only needed if columns are hidden from the DOM. It is generally placed on row children, rather than on the row itself. If the columns displayed are contiguous, then it can be placed on the row.
The attribute takes as its value an integer between 1 and the total number of columns within the table, grid or treegrid. When placed on the row, the `aria-colindex` defines an element's column index or position with respect to the total number of columns within a row. For example, in a table with 15 columns, and columns 4, 5, and 6 are in the DOM, `aria-colindex="4"` could be set on every row.
If the set of columns which is present in the DOM is **not** contiguous, or if there are cells spanning more than one row or column, put the `aria-colindex` on all of the children of each row instead of on the row itself.
If all the columns are in the DOM, this attribute is not necessary.
- [`aria-rowindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex) attribute
- : The `aria-rowindex` attribute is only needed if rows are hidden from the DOM, to indicate which row, in the list of total rows, is being read. The attribute, placed with a unique value on each row, takes as its value an integer between 1 and the total number of rows within the table, grid or treegrid, indicating the position, or index, of each row. For example, if a table has 1,500 rows, but only the header and rows 47 and 52 are in the DOM, `aria-rowindex="1"` would be set on the header row, and `aria-rowindex="47"` and `aria-rowindex="52"` would be set on the 47th and 52nd row, respectively.
If all the rows are present in the DOM, this attribute is not necessary.
### Keyboard Interactions
None
### Required JavaScript features
None. For sortable columns, see the [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role) aria role.
> **Note:** The first rule of ARIA use is you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and **adding** an ARIA role, state or property to make it accessible, then do so. Employ the HTML {{HTMLElement('table')}} element instead of the ARIA role of table whenever possible.
## Examples
```html
<div
role="table"
aria-label="Semantic Elements"
aria-describedby="semantic_elements_table_desc"
aria-rowcount="81">
<div id="semantic_elements_table_desc">
Semantic Elements to use instead of ARIA's roles
</div>
<div role="rowgroup">
<div role="row">
<span role="columnheader" aria-sort="none">ARIA Role</span>
<span role="columnheader" aria-sort="none">Semantic Element</span>
</div>
</div>
<div role="rowgroup">
<div role="row" aria-rowindex="11">
<span role="cell">header</span>
<span role="cell">h1</span>
</div>
<div role="row" aria-rowindex="16">
<span role="cell">header</span>
<span role="cell">h6</span>
</div>
<div role="row" aria-rowindex="18">
<span role="cell">rowgroup</span>
<span role="cell">thead</span>
</div>
<div role="row" aria-rowindex="24">
<span role="cell">term</span>
<span role="cell">dt</span>
</div>
</div>
</div>
```
The above is a non-semantic ARIA table with five of 81 rows present in the DOM: One within a table header and four rows within the table body. The header row, alone in a header rowgroup, has two column headers. The columns are sortable, but not currently sorted, as indicated by the `aria-sort` property. The table body is in a separate rowgroup, with four rows currently in the DOM. Because not all the rows are in the DOM, we've included the `aria-rowindex` property on every row.
## Best practices
Only use {{HTMLElement('table')}}, {{HTMLElement('tbody')}}, {{HTMLElement('thead')}}, {{HTMLElement('tr')}}, {{HTMLElement('th')}}, {{HTMLElement('td')}}, etc., for data table structure. You can add these ARIA roles to ensure accessibility should the native semantics of the table be removed, such as with CSS. A relevant use case for the ARIA table role is when the native semantics of a table are overridden by CSS's display property, such as by display: grid. In this case, you can use the ARIA table roles to add the semantics back in.
```html
<table
role="table"
aria-label="Semantic Elements"
aria-describedby="semantic_elements_table_desc"
aria-rowcount="81">
<caption id="semantic_elements_table_desc">
Semantic Elements to use instead of ARIA's roles
</caption>
<thead role="rowgroup">
<tr role="row">
<th role="columnheader" aria-sort="none">ARIA Role</th>
<th role="columnheader" aria-sort="none">Semantic Element</th>
</tr>
</thead>
<tbody role="rowgroup">
<tr role="row" aria-rowindex="11">
<td role="cell">header</td>
<td role="cell">h1</td>
</tr>
<tr role="row" aria-rowindex="16">
<td role="cell">header</td>
<td role="cell">h6</td>
</tr>
<tr role="row" aria-rowindex="18">
<td role="cell">rowgroup</td>
<td role="cell">thead</td>
</tr>
<tr role="row" aria-rowindex="24">
<td role="cell">term</td>
<td role="cell">dt</td>
</tr>
</tbody>
</table>
```
Above is the semantic way of writing a table. The ARIA roles are only necessary if the native semantics of the table, and therefore the table rows, are obliterated, such as via setting the [display property to flex or grid](/en-US/docs/Web/CSS/display#accessibility_concerns).
### Added benefits
none
## Specifications
{{Specifications}}
## See also
- The HTML {{HTMLElement('tr', '<code><tr></code> table row')}} element
- {{HTMLElement('table')}}
- [The `rowgroup` role](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role)
- [The `table` role](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role)
- [The `grid` role](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role)
- [The `treegrid` role](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
- [The `cell` role](/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
- [The `gridcell` role](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [The `columnheader` role](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [The `rowheader` role](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/roletype_role/index.md | ---
title: "ARIA: roletype role"
slug: Web/Accessibility/ARIA/Roles/roletype_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#roletype
---
The **`roletype`** role, an [abstract role](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles), is the base role from which all other ARIA roles inherit.
> **Note:** The `roletype` role is an abstract role used for the ontology. It is included here for completeness of documentation. It should not be used by web authors.
## Description
The `roletype` role's properties describe the structural and functional purpose of objects that are assigned this role, or "instances". A role is a concept that can be used to understand and operate instances.
Note
## Best Practices
Do not use.
## Specifications
{{Specifications}}
## See also
- [ARIA: `structure` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structure_role)
- [ARIA: `widget` role](/en-US/docs/Web/Accessibility/ARIA/Roles/widget_role)
- [ARIA: `window` role](/en-US/docs/Web/Accessibility/ARIA/Roles/window_role)
- The HTML [`rel`](/en-US/docs/Web/HTML/Attributes/rel) attribute
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/range_role/index.md | ---
title: "ARIA: range role"
slug: Web/Accessibility/ARIA/Roles/range_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#range
---
The `range` abstract role is a generic type of structure role representing a range of values.
> **Note:** The `range` role is an [abstract role](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles). It is included here for completeness of documentation. It is not to be used by web authors.
## Description
The `range` role is an abstract role. It must not be used by web authors. It is the superclass for structural roles for elements that accept a value within a range of values, including the [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role) role, [`progressbar`](/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role) and [`slider`](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role). For these three, consider using the {{HTMLElement("meter")}} element, the {{HTMLElement("progress")}} element, and the {{HTMLElement("input/range")}}, respectively.
## Best Practices
Do not use.
## Specifications
{{Specifications}}
## See also
- [ARIA: `structure` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structure_role)
- [ARIA: `meter` role](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role)
- [ARIA: `progressbar` role](/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role)
- [ARIA: `scrollbar` role](/en-US/docs/Web/Accessibility/ARIA/Roles/scrollbar_role)
- [ARIA: `slider` role](/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role)
- [ARIA: `spinbutton` role](/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role)
- {{HTMLElement("input/range")}}
- {{HTMLElement("meter")}}
- {{HTMLElement("progress")}}
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/combobox_role/index.md | ---
title: "ARIA: combobox role"
slug: Web/Accessibility/ARIA/Roles/combobox_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#combobox,
- https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
---
The `combobox` role identifies an element as an `input` that controls another element, such as a `listbox` or `grid`, that can dynamically pop up to help the user set the value of that `input`.
## Description
A `combobox` is a composite widget that combines a named input field with a popup providing possible values for that input field. The purpose of this widget is to improve user experience by helping the user select a value without having to type in the complete value and, optionally depending whether supported values are limited, preventing the user from entering invalid or otherwise unsupported values.
The `combobox` role is set on input that controls another element, such as a listbox or grid, that can dynamically pop up to help the user set the value of the input.
The `combobox` input field can either be a single-line text field that supports editing and typing, similar to a HTML {{HTMLElement('input')}} with a {{HTMLElement('datalist')}}, or an element that only displays the current value of the combobox.
A WAI-ARIA combobox only has one attribute that is required that authors specify: [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded). However, it also has several other attributes which will be necessary to specify, depending on the combobox's implementation. These include [`aria-haspopup`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup), [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls), [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant), and [`aria-autocomplete`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-autocomplete).
Typically, the initial state of a combobox is collapsed, with `aria-expanded="false"` set. In the collapsed state, only the combobox element and, optionally a sibling button to invoke the popup, are visible. The [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded), with the value set to `false`, is required when collapsed, because it indicates to assistive technologies that the widget is expandable.
The combobox is in the expanded state when both the combobox element showing its current value and its associated popup element are visible. When expanded, `aria-expanded="true"` must be set.
The popup element associated with a `combobox` can be either a [`listbox`](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role), [`tree`](/en-US/docs/Web/Accessibility/ARIA/Roles/tree_role), [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role), or [`dialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role) element.
Comboboxes have an implicit [`aria-haspopup`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup) value of `listbox`, so including this attribute is optional if the popup is a `listbox`. If the combobox popup element is a `tree`, `grid`, or `dialog` (anything other than a `listbox`), the `aria-haspopup` attribute is required. The value of `aria-haspopup` must be either the `tree`, `grid`, `dialog`, or `listbox` role. Note that for this property, `true` means `menu`, so make sure that the value corresponds to the role of the popup, not a Boolean value.
When a combobox's popup is displayed, ensure the [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) attribute on the combobox element is set to the [`id`](/en-US/docs/Web/HTML/Global_attributes#id) of the popup `listbox`, `tree`, `grid`, or `dialog` element. This is how the relationship between the element with the `combobox` role and the popup it controls is indicated. (Note: In older ARIA specs, this was `aria-owns` rather than `aria-controls`, so you may see `aria-owns` in older combobox implementations. The `aria-owns` in the code should be updated to `aria-controls`!)
If the combobox UI includes a visible control, such as an icon, that allows the visibility of the popup to be controlled via pointer and touch events, that control should be a {{HTMLElement('button')}}, {{HTMLElement('input')}} of type `button`, or a [`button`](/en-US/docs/Web/Accessibility/ARIA/Roles/button_role) role element with a [`tabindex`](/en-US/docs/Web/HTML/Global_attributes#tabindex) of `-1`. Doing so will allow the button to be focusable but not included in keyboard tab sequence. It must not be a descendant of the element with role `combobox`.
To be keyboard accessible, keyboard support for moving focus between the `combobox` input field element and elements contained in the popup `listbox`, `tree`, `grid`, or `dialog`, must be programmed in. One common convention is that <kbd>Down Arrow</kbd> moves focus from the input to the first focusable descendant of the popup element.
The [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant) property can be used to identify the currently active element of the combobox popup, for instance an `option` within a popup `listbox`, for implementations where DOM focus remains on the combobox. If DOM focus does not remain on the combobox when its popup is invoked, but rather DOM focus moves into the popup, such as a dialog, then `aria-activedescendant` may not be necessary.
If the combobox element is an {{HTMLElement('input')}} element, the value of the combobox is the input's value. Otherwise, the value of the combobox comes from its descendant elements.
If the `combobox` supports text input and provides autocompletion behavior, set [`aria-autocomplete`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-autocomplete) on the combobox element to the value that corresponds to the provided behavior: `inline`, `list`, or `both`. The `aria-autocomplete` attribute indicates that inputting text will trigger display of one or more predictions of the user's intended value for the combobox and specifies how the predictions will be presented when made.
Every `combobox` must have an accessible name. If using an {{HTMLElement('input')}} element, the accessible name should come from the associated {{HTMLElement('label')}}. If not, if an appropriate label is visible in the content, provide the name via [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby). In other words, if there is an element in the user interface that serves as a label for the `combobox` input field, include `aria-labelledby` as an attribute on the element with the role of `combobox`, and set the value of the attribute to the `id` of the labelling element or elements. If no visible label is present, use [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) instead. Not both.
### Associated WAI-ARIA roles, states, and properties
- [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded)
- : Required. Identifies whether the combobox is open (`true`) or closed (`false`).
- [`aria-haspopup`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup)
- : Implied. If omitted, defaults to `listbox`. Also supports `tree`, `grid`, or `dialog`. Identifies the combobox has having a popout, and indicates the type.
### Keyboard interactions
- <kbd>Down Arrow</kbd>
- : Moves focus to the next option, or to the first option if none was selected.
- <kbd>Alt</kbd> + <kbd>Down Arrow</kbd> (Optional)
- : If the popup is available but not displayed, displays the popup without moving focus.
- <kbd>Up Arrow</kbd>
- : Moves focus to the previous option. Moving focus to the first option if focus was originally on the last option.
- <kbd>Alt</kbd> + <kbd>Up Arrow</kbd> (Optional)
- : If the popup has focus, returns focus to the combobox, otherwise it closes the popup.
- <kbd>Enter</kbd>
- : If the combobox is editable and an autocomplete suggestion is selected in the popup, accepts the suggestion either by placing the input cursor at the end of the accepted value in the combobox or by performing a default action on the value. For example, in a messaging application, the default action may be to add the accepted value to a list of message recipients and then clear the combobox so the user can add another recipient.
## Examples
```html
<label for="jokes">Pick what type of jokes you like</label>
<div class="combo-wrap">
<input
type="text"
id="jokes"
role="combobox"
aria-controls="joketypes"
aria-autocomplete="list"
aria-expanded="false"
data-active-option="item1"
aria-activedescendant="" />
<span aria-hidden="true" data-trigger="multiselect"></span>
<ul id="joketypes" role="listbox" aria-label="Jokes">
<li class="active" role="option" id="item1">Puns</li>
<li class="option" role="option" id="item2">Riddles</li>
<li class="option" role="option" id="item3">Observations</li>
<li class="option" role="option" id="item4">Knock-knock</li>
<li class="option" role="option" id="item5">One liners</li>
</ul>
</div>
```
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement('label')}} element
- HTML {{HTMLElement('select')}} element
- HTML {{HTMLElement('option')}} element
- HTML {{HTMLElement('input')}} element
- [ARIA: `listbox` role](/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role)
- [ARIA: `option` role](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role)
- [ARIA: `list` role](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role)
- [ARIA: `listitem` role](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role)
- [ARIA Best Practices – Combobox](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/)
- [ARIA Role Model – Combobox](https://www.w3.org/TR/wai-aria-1.2/#combobox)
- [Accessible combobox module](https://dequelabs.github.io/combobo/demo/) examples by Deque
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/math_role/index.md | ---
title: "ARIA: math role"
slug: Web/Accessibility/ARIA/Roles/math_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#math
---
The `math` role indicates that the content represents a mathematical expression.
## Description
Content with the role `math` is intended to be marked up in an accessible format such as [MathML](/en-US/docs/Web/MathML), or with another type of textual representation, which can be converted to an accessible format by the browser or a polyfill library.
Unfortunately, browser support for MathML is not universal. While using an image of a mathematical expression is not optimal, if you do use image, use the `math` role.
Make sure any images of math are labeled by an `alt` attribute that describes the mathematical expression as it would be spoken.
If the math element has only presentational children and the accessible name is intended to convey the mathematical expression, use [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) to provide a string that represents the expression. If the math element contains navigable content that conveys the mathematical expression and a visible label for the expression is present, use [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby). Otherwise, use `aria-label` to name the expression, e.g., `aria-label="Pythagorean Theorem"`.
## Examples
If you use image or non-semantic HTML to create an equation, use the `math` role.
<div role="math" aria-label="a^{2} + b^{2} = c^{2}">
a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup>
</div>
The above pythagorean theorem is written accessibly as:
```html
<div role="math" aria-label="a^{2} + b^{2} = c^{2}">
a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup>
</div>
```
Had an image been used, the `alt` attribute would be used along with the `math` role:
```html
<img src="pythagorean_theorem.gif" alt="a^{2} + b^{2} = c^{2}" role="math" />
```
## Specifications
{{Specifications}}
## See also
- [MathML on MDN](/en-US/docs/Web/MathML) and the [`<math>`](/en-US/docs/Web/MathML/Element/math) element (not HTML)
- [The MathML specification](https://www.w3.org/TR/MathML3/)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/alert_role/index.md | ---
title: "ARIA: alert role"
slug: Web/Accessibility/ARIA/Roles/alert_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#alert
- https://www.w3.org/TR/wai-aria-1.2/#alert
---
The `alert` role is for important, and usually time-sensitive, information. The `alert` is a type of [`status`](/en-US/docs/Web/Accessibility/ARIA/Roles/status_role) processed as an atomic live region.
## Description
The `alert` role is used to communicate an important and usually time-sensitive message to the user. When this role is added to an element, the browser will send out an accessible alert event to assistive technology products which can then notify the user.
The alert role should only be used for information that requires the user's immediate attention, for example:
- An invalid value was entered into a form field
- The user's login session is about to expire
- The connection to the server was lost so local changes will not be saved
The `alert` role should only be used for text content, not interactive elements such as links or buttons. The element with the `alert` role does not have to be able to receive focus, as screen readers (speech or braille) will automatically announce the updated content regardless of where keyboard focus when the role is added.
The `alert` role is added to the node containing an alert message, **not** the element causing the alert to be triggered. Alerts are [assertive live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions). Setting `role="alert"` is equivalent to setting [`aria-live="assertive"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) and [`aria-atomic="true"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic). As they don't receive focus, focus does not need to be managed and no user interaction should be required.
> **Warning:** Because of its intrusive nature, the `alert` role must be used sparingly and only in situations where the user's immediate attention is required.
The [`alert`](https://www.w3.org/TR/wai-aria-1.1/#alert) role is of the five [live region](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) roles. Dynamic changes that are less urgent should use a less aggressive method, such as including `aria-live="polite"` or using an other live region role like [`status`](/en-US/docs/Web/Accessibility/ARIA/Roles/status_role). If the user is expected to close the alert, then the [`alertdialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role) role should be used instead.
The most important thing to know about the `alert` role is that it's for content that is dynamically displayed, not for content that appears on page load. It is perfect for situations such as when a user fills out a form and JavaScript is used to add an error message - the alert would immediately read out the message. It should not be used on HTML that the user hasn't interacted with. For example, if a page loads with multiple visible alerts scattered throughout, the alert role should not be used, as the messages were not dynamically triggered.
As with all other [live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions), alerts will only be announced when the content of the element with `role="alert"` is _updated_. Make sure that the element with the role is present in the page's markup first - this will "prime" the browser and screen reader to keep watching the element for changes. After this, any changes to the content will be announced. Do not try to dynamically add/generate an element with `role="alert"` that is already populated with the alert message you want announced - this generally does _not_ lead to an announcement, as it is not a content change.
As the `alert` role reads out any content that has changed, it should be used with caution. Alerts, by definition, are disruptive. Several alerts at once, and unnecessary alerts, create bad user experiences.
## Examples
The following are common examples of alerts and how to implement them:
### Example 1: Making ready-made content inside an element with an alert role visible
If the content _inside_ the element with `role="alert"` is initially hidden using CSS, making it visible will cause the alert to fire. This means that an existing alert container element can be "reused" multiple times.
```css
.hidden {
display: none;
}
```
```html
<div id="expirationWarning" role="alert">
<span class="hidden">Your log in session will expire in 2 minutes</span>
</div>
```
```js
// removing the 'hidden' class makes the content inside the element visible, which will make the screen reader announce the alert:
document
.getElementById("expirationWarning")
.firstChild.classList.remove("hidden");
```
### Example 2: Dynamically changing the content inside an element with an alert role
Using JavaScript, you can dynamically change the content _inside_ the element with `role="alert"`. Note that if you need to fire the same alert multiple times (i.e. the content you're dynamically inserting is the same as before), this generally won't be seen as a change and will _not_ lead to an announcement. For this reason, it's usually best to briefly "clear" the contents of the alert container before then injecting the alert message.
```html
<div id="alertContainer" role="alert"></div>
```
```js
// clear the contents of the container
document.getElementById("alertContainer").innerHTML = "";
// inject the new alert message
document.getElementById("alertContainer").innerHTML =
"Your session will expire in " + expiration + " minutes";
```
### Example 3: Visually hidden alert container for screen reader notifications
It's possible to visually hide the alert container itself, and use it to provide updates/notifications explicitly for screen readers. This can be useful in situations where important content on the page has been updated, but where the change would not be immediately obvious to a screen-reader user.
However, make sure that the container is not hidden using `display:none`, as this will hide it even from assistive technologies, meaning that they won't be notified of any changes. Instead, use something like the [`.visually-hidden` styles](https://www.a11yproject.com/posts/how-to-hide-content/).
```html
<div id="hiddenAlertContainer" role="alert" class="visually-hidden"></div>
```
```css
.visually-hidden {
clip: rect(0 0 0 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
```
```js
// clear the contents of the container
document.getElementById("hiddenAlertContainer").innerHTML = "";
// inject the new alert message
document.getElementById("hiddenAlertContainer").innerHTML =
"All items were removed from your inventory.";
```
## Specifications
{{Specifications}}
## See also
- [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live)
- [`aria-atomic`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic)
- [ARIA: `log` role](/en-US/docs/Web/Accessibility/ARIA/Roles/log_role)
- [ARIA: `marquee` role](/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role)
- [ARIA: `status` role](/en-US/docs/Web/Accessibility/ARIA/Roles/status_role)
- [ARIA: `timer` role](/en-US/docs/Web/Accessibility/ARIA/Roles/timer_role)
- [ARIA: `alertdialog` role](/en-US/docs/Web/Accessibility/ARIA/Roles/alertdialog_role)
- [ARIA: live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)
- [ARIA alert support - The Paciello Group](https://www.tpgi.com/aria-alert-support/)
- [ARIA Practices alert example](https://www.w3.org/WAI/ARIA/apg/patterns/alert/examples/alert/)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/cell_role/index.md | ---
title: "ARIA: cell role"
slug: Web/Accessibility/ARIA/Roles/cell_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#cell
- https://www.w3.org/WAI/ARIA/apg/patterns/table/examples/table/
---
The `cell` value of the ARIA _role_ attribute identifies an element as being a cell in a tabular container that does not contain column or row header information. To be supported, the cell must be nested in an element with the role of `row`.
```html
<div role="row">
<span role="cell">France</span>
<span role="cell">67 million</span>
</div>
```
A better, more semantic way of writing the cells above would be to use the semantic [`<td>`](/en-US/docs/Web/HTML/Element/td) element.
```html
<tr role="row">
<td role="cell">France</td>
<td role="cell">67 million</td>
</tr>
```
## Description
The element with `role="cell"` is a cell within a row, optionally within a [`rowgroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role), within a [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role). If the cell is in a [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role) or [`treegrid`](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role), opt for [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role). Using native HTML {{HTMLElement('td')}} elements, whenever possible, is strongly encouraged.
Each element with `role="cell"` MUST be nested in a container element with [`role="row"`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role). That row, in turn, can be nested within an element with [`role="rowgroup"`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role), and should be nested within a `grid`, `table` or `treegrid`. If a cell contains column or row header information, use the `columnheader` or `rowheader` roles, respectively. If the cell does not contain header information and is nested in a `grid` or `treegrid`, the role of `gridcell` may be more appropriate.
A cell can contain a number of property attributes clarifying the cell's position within the tabular data structure, including [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex), [`aria-colspan`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colspan), [`aria-rowindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex), and [`aria-rowspan`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowspan).
> **Note:** Using the native HTML table element ({{HTMLElement('table')}}) element, along with the table row element ({{HTMLElement('tr')}}), and table cell element ({{HTMLElement('td')}}), whenever possible, is strongly encouraged.
### Associated WAI-ARIA roles, states, and properties
#### Context roles
- [role="row"](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- : An element with `role="row"` is a row of cells within a tabular structure. A row contains one or more cells, grid cells, column headers, or row headers within a [`grid`](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role), [`table`](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role) or `treegrid`, and optionally within a [`rowgroup`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role).
- [role="rowgroup"](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role)
- : `Row` is a required cell parent. `Rowgroup` is an optional contextual row parent. It establishes a relationship between descendant rows. It is a structural equivalent to the [`thead`](/en-US/docs/Web/HTML/Element/thead), [`tfoot`](/en-US/docs/Web/HTML/Element/tfoot), and [`tbody`](/en-US/docs/Web/HTML/Element/tbody) elements in an [HTML `table`](/en-US/docs/Learn/HTML/Tables/Basics) element.
- [role="table"](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role)
- : One of the three possible contexts (along with `grid` and `treegrid`) in which you'll find a row containing cells. Table identifies the cell as being part of a non-interactive table structure containing data arranged in rows and columns, similar to the native HTML [`<table>`](/en-US/docs/Web/HTML/Element/table) element.
- [role="grid"](/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role)
- : One of the three possible contexts (along with `table` and `treegrid`) in which you'll find a row containing `cells` and `gridcells`. `Grid` identifies a cell as being part of a possibly interactive table structure containing data arranged in rows and columns, similar to the native [`<table>`](/en-US/docs/Web/HTML/Element/table) HTML element.
- [role="treegrid"](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
- : Similar to a grid, but with rows that can be expanded and collapsed in the same manner as for a tree.
#### Subclass roles
- [role="gridcell"](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- : A cell in a row within a `grid` or `treegrid`.
- [role="columnheader"](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- : A header cell that is the structural equivalent of the HTML [`<th>`](/en-US/docs/Web/HTML/Element/th) element with a column scope. Unlike a plain cell, the `columnheader` role establishes a relationship between it and all cells in the corresponding column.
- [role="rowheader"](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- : A header cell that is the structural equivalent of the HTML [`<th>`](/en-US/docs/Web/HTML/Element/th) element with a row scope. Unlike a plain cell, the `rowheader` role establishes a relationship between it and all cells in the corresponding row.
#### States and properties
- [`aria-colspan`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colspan)
- : Similar to the HTML [`<th>`](/en-US/docs/Web/HTML/Element/th) and [`<td>` colspan attribute](/en-US/docs/Web/HTML/Element/td), it defines the number of columns spanned by the cell.
- [`aria-rowspan`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowspan)
- : Similar to the HTML [`<th>`](/en-US/docs/Web/HTML/Element/th) and [`<td>` rowspan attribute](/en-US/docs/Web/HTML/Element/td), it defines the number of rows spanned by the cell.
- [`aria-colindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-colindex) attribute
- : The `aria-colindex` attribute is only needed if columns are hidden from the DOM. The attribute takes as its value an integer between 1 and the total number of columns within the `table`, `grid` or `treegrid`. The `aria-colindex` defines an element's column index or position with respect to the total number of columns within a row. If all the columns are in the DOM, this attribute is not necessary.
- [`aria-rowindex`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-rowindex) attribute
- : The `aria-rowindex` attribute is only needed if rows are hidden from the DOM, to indicate which row, in the list of total rows, the current cell is in. The attribute, takes as its value an integer between 1 and the total number of rows within the table, grid, or treegrid, indicating the position, or index, of the cell. For example, a cell in the first row of the first header would likely have `aria-rowindex="1"` set, and cells in row 47 would have `aria-rowindex="47"`, if `aria-rowindex` were needed due to not all rows being in the DOM. If the rows that are visible are contiguous, and there are no cells with a `colspan` or `rowspan` greater than one, this property can be added to the parent rows instead of all the rows' cells.
### Keyboard interactions
None
### Required JavaScript features
The first rule of ARIA use is if you can use a native feature with the semantics and behavior you require already built in, instead of repurposing an element and **adding** an ARIA role, state or property to make it accessible, then do so. Employ the HTML [`<td>`](/en-US/docs/Web/HTML/Element/td) element instead of the ARIA role of `cell` whenever possible.
## Examples
```html
<div
role="table"
aria-label="Semantic Elements"
aria-describedby="semantic_elements_table_desc"
aria-rowcount="81">
<div id="semantic_elements_table_desc">
Semantic Elements to use instead of ARIA's roles
</div>
<div role="rowgroup">
<div role="row">
<span role="columnheader" aria-sort="none" aria-rowindex="1"
>ARIA Role</span
>
<span role="columnheader" aria-sort="none" aria-rowindex="1"
>Semantic Element</span
>
</div>
</div>
<div role="rowgroup">
<div role="row">
<span role="cell" aria-rowindex="11">header</span>
<span role="cell" aria-rowindex="11">h1</span>
</div>
<div role="row">
<span role="cell" aria-rowindex="16">header</span>
<span role="cell" aria-rowindex="16">h6</span>
</div>
<div role="row">
<span role="cell" aria-rowindex="18">rowgroup</span>
<span role="cell" aria-rowindex="18">thead</span>
</div>
<div role="row">
<span role="cell" aria-rowindex="24">term</span>
<span role="cell" aria-rowindex="24">dt</span>
</div>
</div>
</div>
```
The above is a non-semantic ARIA table with five of 81 rows present in the DOM: one within a table header and four rows within the table body. Because not all the rows are in the DOM, we've included the `aria-rowindex` property on every cell. If no cells spanned more than one row or column, the `aria-rowindex` could have been placed on the row rather than the row's individual cells.
## Best practices
Only use {{HTMLElement('table')}}, {{HTMLElement('tbody')}}, {{HTMLElement('thead')}}, {{HTMLElement('tr')}}, {{HTMLElement('th')}}, {{HTMLElement('td')}}, etc., for data table structure. You can add ARIA roles to ensure accessibility should the native semantics of the table be removed, such as with CSS. A relevant use case for the ARIA table role is when the native semantics of a table are overridden by [CSS's display property, such as by display: grid](/en-US/docs/Web/CSS/display#accessibility_concerns). In this case, you can use the ARIA table roles to add the semantics back in.
```html
<table
role="table"
aria-label="Semantic Elements"
aria-describedby="semantic_elements_table_desc"
aria-rowcount="81">
<caption id="semantic_elements_table_desc">
Semantic Elements to use instead of ARIA's roles
</caption>
<thead role="rowgroup">
<tr role="row">
<th role="columnheader" aria-sort="none" aria-rowindex="1">ARIA Role</th>
<th role="columnheader" aria-sort="none" aria-rowindex="1">
Semantic Element
</th>
</tr>
</thead>
<tbody role="rowgroup">
<tr role="row">
<td role="cell" aria-rowindex="11">header</td>
<td role="cell" aria-rowindex="11">h1</td>
</tr>
<tr role="row">
<td role="cell" aria-rowindex="16">header</td>
<td role="cell" aria-rowindex="16">h6</td>
</tr>
<tr role="row">
<td role="cell" aria-rowindex="18">rowgroup</td>
<td role="cell" aria-rowindex="18">thead</td>
</tr>
<tr role="row">
<td role="cell" aria-rowindex="24">term</td>
<td role="cell" aria-rowindex="24">dt</td>
</tr>
</tbody>
</table>
```
Above is the semantic way of writing a table. The ARIA roles are not necessary if the native semantics of the table, and therefore the table rows, have not been altered, such as through [the display property](/en-US/docs/Web/CSS/display#accessibility_concerns).
### Added benefits
When applied to a {{HTMLElement('td')}}, it returns cell semantics to the element in case the semantics were removed, such as with `display: grid;`.
## Specifications
{{Specifications}}
## See also
- [`role="row"`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- [`role="gridcell"`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [HTML `<td>` element](/en-US/docs/Web/HTML/Element/td)
- [HTML `<th>` element](/en-US/docs/Web/HTML/Element/th)
- [HTML table advanced features and accessibility](/en-US/docs/Learn/HTML/Tables/Advanced)
- [HTML table basics](/en-US/docs/Learn/HTML/Tables/Basics)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/application_role/index.md | ---
title: "ARIA: application role"
slug: Web/Accessibility/ARIA/Roles/application_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#application
---
The `application` role indicates to assistive technologies that an element _and all of its children_ should be treated similar to a desktop application, and no traditional HTML interpretation techniques should be used. This role should only be used to define very dynamic and desktop-like web applications. Most mobile and desktop web apps _are not_ considered applications for this purpose.
```html
<div role="application" aria-label="…">…</div>
```
By specifying the `application` role, it indicates this `div` element and all of its descendants are to be treated like they are part of a desktop application.
## Description
The `application` [document structure role](/en-US/docs/Web/Accessibility/ARIA/Roles#1._document_structure_roles), indicates to assistive technologies that this part of the web content contains elements that do not conform to any other known HTML element or WAI-ARIA widget. Any sort of special interpretation of HTML structures and widgets should be suspended, and control should be completely handed over to the browser and web application to handle mouse, keyboard, or touch interaction.
In this mode, the web author is completely responsible for handling any and all keyboard input, focus management, and other interactions and cannot assume assistive technologies would do any processing on their end.
If the web application encompassed by the application role contains parts that _should_ be treated like normal web content, a role of [`document`](/en-US/docs/Web/Accessibility/ARIA/Roles/document_role) or [`article`](/en-US/docs/Web/Accessibility/ARIA/Roles/article_role) should be used to contain such content.
### Background
For historic reasons, especially on Windows, screen readers and some other assistive technologies (AT) have traditionally grabbed the whole web content from the browser at once after it had finished loading. The ATs build their own representation of it that makes the most sense for a visually impaired user to consume the content. This is often referred to as _virtual document_, _browse mode_, or similar terms. The document is streamlined to a single-column view. A keyboard interaction model is generated that is very similar to a word processor where users can read line by line, sentence by sentence, or paragraph by paragraph. The AT will read any semantics like links, headings, form controls, tables, lists, or images.
In addition, a set of so-called _quick navigation keys_ has been established over the years that allows visually impaired users to skim through a page via a certain element type. Such elements usually include headings, form fields, lists, tables, links, graphics, or landmark regions.
For all of this to work, ATs intercept almost all keyboard input and consume it themselves, letting nothing through to the browser or other user agent. To be able to interact with a web page, a standard set of widgets is recognized that, when pressing a certain key (usually the <kbd>Enter</kbd> key) this mode is switched off. The screen reader mode, often called _forms mode_ or _focus mode_, lets all keyboard input go through to the browser again. <kbd>Escape</kbd> is the most common way of switching back to _browse_ mode, but when within a specific `application` section, some screen readers may require other keys to purposefully exit this mode. For instance <kbd>NUMPAD PLUS</kbd> with JAWS.
The `application` role is designed to provide a means for widgets that are not part of the standard set to be accessible for direct interaction in ATs that use both _browse_ and _focus_ modes for interacting with web content. Most common widgets have expected keyboard interaction behaviors. Because of this, a custom keyboard experience created by a web author would create a confusing experience.
### Associated WAI-ARIA roles, states, and properties
- [`document`](/en-US/docs/Web/Accessibility/ARIA/Roles/document_role), [`article`](/en-US/docs/Web/Accessibility/ARIA/Roles/article_role)
- : Used to indicate parts of the application that should be treated as normal web content
- [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant)
- : Used to manage focus inside the application.
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- : Used to provide the name of the application or purpose of the widget that is being exposed.
- [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby)
- : Used to indicate the idref of an element that contains additional instructions for navigating or operating this element.
- [`aria-roledescription`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription)
- : Used to give the application a more descriptive role text for screen readers to speak. This should be localized.
- [`aria-disabled`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled)
- : Indicates that an element is visible but disabled
- [`aria-errormessage`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-errormessage)
- : A reference to the element that provides the error message for the element on which it is set
- [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded)
- : If set to `true`, the grouping element owned or controlled by this element is expanded, or `false` if collapsed.
- [`aria-haspopup`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup)
- : Indicates there is a popup, such as menu or dialog, that can be triggered by the element.
### Keyboard interactions
Keyboard interaction is completely under the web author's control and can be anything associated with the particular widget being implemented. In a slides application, for example, a widget could be created that uses the arrow keys to position elements on the slide, and uses audio feedback via an ARIA live region to communicate the position and overlap status with other objects. Focus is being managed via _aria-activedescendant_.
The <kbd>Tab</kbd>, <kbd>Space</kbd> and <kbd>Enter</kbd> keys, as well as <kbd>Escape</kbd>, must be handled by the application. The one exception is if focus is set to a standard widget inside the application that supports keyboard navigation from the browser, for example an [input](/en-US/docs/Web/HTML/Element/input) element.
### Required JavaScript features
- keyPress
- : Used to handle keyboard input and control the focus
- Click, Touch
- : Handle as appropriate for your widget as well
- Changing attribute values
- : [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant) is used to manage the focus inside the application container. Set in response to keyboard or other application events that change focus or point of interaction.
> **Note:** The `application` role does not have a related HTML widget and thus is completely free form. The author of the application must take full responsibility for not letting users get stuck in a focus trap inside something the user cannot exit from. All aspects of interaction, including returning to the regular web content on other parts of the page, must be handled. Use wisely, and cautiously, and remember to test!
## Examples
Some prominent web applications that use or have used the application role properly are:
- Google Docs, Sheets and Slides
- CKEditor and TinyMCE WYSIWYG web editors, like the one used on the Mozilla Developer Network
- Some parts of Gmail
## Accessibility concerns
Improperly using the `application` role can unintentionally take away access from information on a web page, so be very mindful of using it. Think hard on if you actually need it and cannot just use a set of other known widgets to accomplish the same task.
If used, the application role should be added to the lowest common container possible, not on the `<body>` element, for example. Also be sure to test what you have written with assistive technology, to verify it works as intended.
## Specifications
{{Specifications}}
## Precedence order
Applying the `application` role will cause this and all of the descendant elements of this element to be treated like application content, not web content. Any reading mechanisms assistive technologies may have for web content will not apply.
## See also
- [If you use the WAI-ARIA role `application`, please do so wisely](https://www.marcozehe.de/if-you-use-the-wai-aria-role-application-please-do-so-wisely/) - blog post by Marco Zehe
- [Using the ARIA `application` role](https://tink.uk/using-the-aria-application-role/) - by Léonie Watson
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/textbox_role/index.md | ---
title: "ARIA: textbox role"
slug: Web/Accessibility/ARIA/Roles/textbox_role
page-type: aria-role
---
The `textbox` role is used to identify an element that allows the input of free-form text. Whenever possible, rather than using this role, use an {{HTMLElement("input")}} element with [type="text"](/en-US/docs/Web/HTML/Element/input/text), for single-line input, or a {{HTMLElement("textarea")}} element for multi-line input.
## Description
When an element has the `textbox` role, the browser sends an accessible textbox event to assistive technologies, which can then notify the user about it.
The default is a single line input, in which <kbd>Return</kbd> or <kbd>Enter</kbd> submits the form; in this case, it is preferable to use an HTML {{HTMLElement("input")}} with `type="text"`. To create a multi-line text box which supports line breaks, as in an HTML {{HTMLElement("textarea")}}, set `aria-multiline="true"`. Including the HTML `contenteditable` attribute ensures the text node is editable.
```html
<!-- Simple text input field -->
<div id="txtboxLabel">Enter your five-digit zipcode</div>
<div
role="textbox"
contenteditable="true"
aria-placeholder="5-digit zipcode"
aria-labelledby="txtboxLabel"></div>
<!-- Multi-line text area -->
<div id="txtboxMultilineLabel">Enter the tags for the article</div>
<div
role="textbox"
contenteditable="true"
aria-multiline="true"
aria-labelledby="txtboxMultilineLabel"
aria-required="true"></div>
```
Semantic elements are more concise and require no JavaScript to support textbox features.
```html
<label for="txtbox">Enter your five-digit zipcode</label>
<input type="text" placeholder="5-digit zipcode" id="txtbox" />
<!-- Multi-line text area -->
<label for="txtboxMultiline">Enter the tags for the article</label>
<textarea id="txtboxMultiline" required></textarea>
```
Where a text field is read-only, indicated this by setting `aria-readonly="true"` on the element.
### Associated ARIA properties
- [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant) attribute
- : Taking as it's value the ID of is either a descendant of the element with DOM focus or is a logical descendant as indicated by the [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns) attribute, it indicates when that element has focus, when it is part of a composite widget such as a [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role). For example, in a combobox, focus may remain on the textbox while the value of `aria-activedescendant` on the textbox element refers to a descendant of a popup listbox that is controlled by the textbox. This attribute must be updated programmatically as the focus changes.
- [`aria-autocomplete`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-autocomplete) attribute
- : Indicates whether and how the user's input into the field could trigger display of a prediction of the intended value. It supports the following values:
- `inline`: Predicted text is inserted after the caret.
- `list`: Predicted text is presented as a collection of values.
- `both`: Predicted text is presented as a collection of values, with the text needed to complete one value inserted after the caret.
- `none` (default): Predicted text is not offered.
If list or both is set, the [`aria-controls`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls) and [`aria-haspopup`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup) attributes should also be included. The value of `aria-controls` is the ID of the element that contains the list of suggested values. Additionally, either the textbox or a containing element with role `combobox` has a value for `aria-haspopup` that matches the role of the element that contains the list of suggested values.
- [`aria-multiline`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiline) attribute
- : If `aria-multiline="true`" is set, the AT informs the user that the textbox supports multi-line input, with the expectation that
<kbd>Enter</kbd>
or
<kbd>Return</kbd>
will create a line break rather than submitting the form. ARIA does not alter the behavior of the element; rather this feature must be controlled by the developer. If false is set, or the attribute is omitted and defaults to false, the user expectation is that the control is a single line text box, and
<kbd>Enter</kbd>
or
<kbd>Return</kbd>
submits the form.
- [`aria-placeholder`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-placeholder) attribute
- : Represents a hint (word or phrase) to the user about what to enter into the text field. The hint should be a sample value or a brief description of the expected format. This information should not be used as a substitute for a label: a label is focusable, permanent, indicates what kind of information is expected, and increases the hit area for setting focus on the control, whereas placeholder text is only temporary hint about the expected value, which if implemented incorrectly can decrease accessibility. The placeholder should be visible when the control's value is the empty string such as when the control first receives focus and when users remove a previously-entered value. Instead of using `aria-placeholder`, use the semantic `<input type="text">` or `<textarea>` with a `placeholder` attribute.
- [`aria-readonly`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly) attribute
- : Indicates that the user cannot modify the value of the text field. Instead of using `aria-readonly`, use the semantic `<input type="text">` or `<textarea>` with a `readonly` attribute.
- [`aria-required`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-required) attribute
- : Indicates that a value must be provided for the field before it is submitted. Instead of using `aria-required`, use the semantic `<input type="text">` or `<textarea>` with a `required` attribute.
### Keyboard interactions
In a single-line use (when `aria-multiline` is `false` or not used), the Return or Enter key submits the form. In a multi-line use (when `aria-multiline` is `true`), Return or Enter key inserts a line break.
### JavaScript features
All features associated with any and all properties and states must be maintained, and forms submission on enter or return on a single line textbox needs to be handled.
- Focus event handler and aria-activedescendant attribute
- : If you are implementing a composite widget, such as a combobox composed of a text box and a listbox, you need to manage the `aria-activedescendant` attribute using a handler. Before using this technique, ensure that the browsers you need to target currently support it. See the [specification of aria-descendant](https://www.w3.org/TR/wai-aria-1.1/#aria-activedescendant) for further information.
> **Note:**It is a better practice to use an {{HTMLElement("input")}} element with type="text", or a {{HTMLElement("textarea")}} element instead of the ARIA textbox role. When using either semantic element, the ARIA textbox role is not necessary. See [Notes on Using ARIA in HTML](https://www.w3.org/TR/aria-in-html/).
## Possible effects on user agents and assistive technology
When the `textbox` role is added to an element, or such an element becomes visible, the user agent should do the following:
- Expose the element as having a textbox role in the operating system's accessibility API.
- Fire an accessible textbox event using the operating system's accessibility API if it supports it.
Assistive technology products should listen for such an event and notify the user accordingly:
- Screen readers should announce its label and role when focus first lands on a textbox. If it also contains content, this should be announced as with a regular textbox.
- Screen magnifiers may enlarge the textbox.
> **Note:** Opinions may differ on how assistive technology should handle this technique. The information provided above is one of those opinions and may be experienced differently.
## Examples
### Example 1: Adding the role in the HTML code for single line input
The snippet below shows how the textbox role is added directly into the HTML source code.
```html
<div role="textbox" contenteditable="true"></div>
```
### Example 2: Adding the role in the HTML code for multi-line input
The snippet below shows how the textbox role is added directly into the HTML source code.
```html
<div role="textbox" contenteditable="true" aria-multiline="true"></div>
```
## Best practices
- Be sure to add the `contenteditable="true"` attribute to the HTML element to which this role is applied. Do so even if you set `aria-readonly` to `true`; in this way, you communicate that the content would be editable if it were not read-only.
## See also
- [ARIA: search role](/en-US/docs/Web/Accessibility/ARIA/Roles/search_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/contentinfo_role/index.md | ---
title: "ARIA: contentinfo role"
slug: Web/Accessibility/ARIA/Roles/contentinfo_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#contentinfo
- https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/contentinfo.html
---
The `contentinfo` role defines a footer, containing identifying information such as copyright information, navigation links, and privacy statements, found on every document within a site. This section is commonly called a footer.
```html
<div role="contentinfo">
<h2>Footer</h2>
<!-- footer content -->
</div>
```
This is a website footer. Using the {{HTMLElement('footer')}} element instead is recommended:
```html
<footer>
<h2>Footer</h2>
<!-- footer content -->
</footer>
```
## Description
The `contentinfo` role is [a landmark](/en-US/docs/Web/Accessibility/ARIA/Roles#3._landmark_roles) used to identify a page footer. Landmarks can be used by assistive technology to quickly identify and navigate to large sections of the document. Pages should only include one top-level `contentinfo` landmark role per page.
Each page should only include one `contentinfo` landmark, created by either using the {{HTMLElement('footer')}} element or by declaring `role="contentinfo"`. `contentinfo` landmarks present in content embedded via {{HTMLElement('iframe')}} do not count towards this limit.
> **Note:** Using the {{HTMLElement('footer')}} element will automatically communicate a section has a role of `contentinfo`. Developers should always prefer using the correct semantic HTML element over using ARIA, making sure to {{HTMLElement('footer#accessibility_concerns', 'test for known issues')}} in VoiceOver.
## Examples
```html
<body>
<!-- other page content -->
<div role="contentinfo">
<h2>MDN Web Docs</h2>
<ul>
<li><a href="#">Web Technologies</a></li>
<li><a href="#">Learn Web Development</a></li>
<li><a href="#">About MDN</a></li>
<li><a href="#">Feedback</a></li>
</ul>
<p>
© 2005-2012 Mozilla and individual contributors. Content is available
under <a href="#">these licenses</a>.
</p>
</div>
</body>
```
## Accessibility concerns
### Use sparingly
[Landmark roles](/en-US/docs/Web/Accessibility/ARIA/Roles#3._landmark_roles) are intended to identify larger overall sections of the document. Using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page.
### One `contentinfo` landmark per page
#### The `<body>` element
There should be only one `contentinfo` landmark per document, used as the immediate descendant of the {{HTMLElement('body')}} element.
#### Mega-footers
Do not nest additional {{HTMLElement('footer')}} elements or `contentinfo` landmarks inside the document's footer. Use other [content sectioning elements](/en-US/docs/Web/HTML/Element#content_sectioning) instead.
### Labeling landmarks
#### Multiple landmarks
If there is more than one `contentinfo` landmark role or {{HTMLElement('footer')}} element in a document, provide a label with the [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) attribute for each landmark. This label will allow assistive technology users to quickly understand the purpose of each landmark.
```html
<body>
…
<article>
<h2>Everyday Pad Thai</h2>
<!-- article content -->
<footer aria-label="Everyday Pad Thai metadata">
<p>
Posted on <time datetime="2021-09-23 12:17">September 23</time> by
<a href="#">Lisa</a>.
</p>
</footer>
</article>
…
<footer aria-label="Footer">
<!-- footer content -->
</footer>
</body>
```
#### Redundant descriptions
Screen readers will announce the type of role the landmark is. Because of this, you do not need to describe what the landmark is in its label. For example, a declaration of `role="contentinfo"` with an of `aria-label="Footer"` may be announced redundantly as, "contentinfo footer".
## Best practices
### Prefer HTML
When it is an immediate descendant of the {{HTMLElement('body')}} using the {{HTMLElement('footer')}} element will automatically communicate a section has a role of `contentinfo` (save for {{HTMLElement('footer#accessibility_concerns', 'a known issue')}} in VoiceOver). If at all possible, prefer using `<footer>` instead. Note that a `footer` element nested within an `article`, `aside`, `main`, `nav`, or `section` is not considered `contentinfo`.
### Added benefits
Certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document.
- [Landmarks browser extension](https://matatk.agrip.org.uk/landmarks/)
## Specifications
{{Specifications}}
## See also
- The {{HTMLElement('footer')}} element
- [contentinfo (role): Accessible Rich Internet Applications (WAI-ARIA) 1.1](https://www.w3.org/TR/wai-aria/#contentinfo)
- [Using HTML sections and outlines](/en-US/docs/Web/HTML/Element/Heading_Elements)
- [Using WAI-ARIA Landmarks – 2013 | The Paciello Group](https://www.tpgi.com/using-wai-aria-landmarks-2013/)
- [Accessible Landmarks | scottohara.me](https://www.scottohara.me/blog/2018/03/03/landmarks.html)
- [The Footer Element Update | HTML5 Doctor](https://html5doctor.com/the-footer-element-update/)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/mark_role/index.md | ---
title: "ARIA: mark role"
slug: Web/Accessibility/ARIA/Roles/mark_role
page-type: aria-role
---
The `mark` role denotes content which is marked or highlighted for reference or notation purposes, due to the content's relevance in the enclosing context.
## Description
The `mark` role semantically denotes HTML elements containing text that is marked/highlighted for reference purposes. This is semantically equivalent to the HTML {{HTMLElement('mark')}} element. If possible, you should use this element instead.
Example uses for `mark` are the exact same as the `<mark>` element. They include highlighting text in a quotation which is of special interest but is not marked in the original source material, comparable to using a highlighter pen to mark passages of a print article and indicating portions of the content that are relevant to the user's current activity, such as highlighting text matches found by a search feature.
Don't use `mark` for purely decorative styling such as syntax highlighting.
The `mark` element should not be given an accessible name; both [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) and [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) attributes are prohibited on `mark`.
## Examples
In the following example we have a document section that has been commented. The commented section is marked up using `<span role="mark">`.
```html
<p>
The last half of the song is a slow-rising crescendo that peaks at the
<span role="mark" aria-details="thread-1">end of the guitar solo</span>,
before fading away sharply.
</p>
<div role="comment" id="thread-1" data-author="chris">
<h3>Chris said</h3>
<p class="comment-text">I really think this moment could use more cowbell.</p>
<p><time datetime="2022-03-30T19:29">March 30 2022, 19:29</time></p>
</div>
```
The related comment is marked up using an HTML structure wrapped with a {{HTMLElement('div')}} containing [`role="comment"`](/en-US/docs/Web/Accessibility/ARIA/Roles/comment_role).
To associate the comment with the text being commented, we need to wrap the commented text with an element containing the [`aria-details`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-details) attribute, the value of which should be the ID of the comment.
## Best practices
### Prefer HTML
Using the {{HTMLElement('mark')}} element will automatically communicate a node has a role of `mark`. If at all possible, prefer using it instead.
## Specifications
Will be part of [WAI-ARIA 1.3](https://w3c.github.io/aria/#mark), which is still being drafted.
## See also
- HTML {{HTMLElement('mark')}} element
- [ARIA annotations](/en-US/docs/Web/Accessibility/ARIA/Annotations)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/structural_roles/index.md | ---
title: "ARIA: document structural roles"
slug: Web/Accessibility/ARIA/Roles/structural_roles
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#document_structure_roles
---
ARIA document-structure roles are used to provide a structural description for a section of content.
Structural ARIA roles were originally created as a bridge to inform assistive technologies of HTML5 elements that were not yet fully supported in browsers. Some roles, like `presentation`, `toolbar` and `tooltip`, provide information on the document structure to assistive technologies in cases where equivalent native HTML elements don't exist. Other roles, including those listed in the table below, are not needed, as there are semantic HTML elements with the same meanings. In many cases, these equivalent HTML elements have always been supported.
> **Note:** These structural roles all have semantic HTML equivalents. They are included here for completeness of documentation. Preferably, they should not be used by web authors.
Some structural roles, like [`suggestion`](/en-US/docs/Web/Accessibility/ARIA/Roles/suggestion_role), don't have HTML equivalents, and therefore have separate documentation. Some structural roles with HTML equivalents, like [`heading`](/en-US/docs/Web/Accessibility/ARIA/Roles/heading_role), have ARIA-attribute requirements. They are listed below with links to their individual role documentation.
Most of the following roles were never needed but were added to ARIA for completeness. We've included them here for completeness as well.
## Structural roles with HTML equivalents
The structure roles with HTML equivalents are listed below:
| ARIA role & description | HTML Equivalent |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`associationlist`** <br> Contains only `associationlistitemkey` children and their sibling `associationlistitemvalue`. | {{HTMLElement('dl')}} |
| **`associationlistitemkey`** <br/> Must be contained in an `associationlist`. | {{HTMLElement('dt')}} |
| **`associationlistitemvalue`** <br/> Always a sibling following an `associationlistitemkey`. | {{HTMLElement('dd')}} |
| **`blockquote`** <br/> A section of content that is quoted from another source. | {{HTMLElement('blockquote')}} |
| **`caption`** <br>Visible content that names, and may also describe, a `figure`, `table`, `grid`, or `treegrid`.<br/> Only found in those 4 roles. A caption's `id` is generally referenced by a `figure`, `grid`, `table`, or `treegrid`'s `aria-labelledby` attribute.<br/> Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('caption')}} <br/> {{HTMLElement('figcaption')}} |
| **`code`** <br/> A section representing a fragment of computer code. <br/> Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('code')}} |
| **`deletion`** <br/>Content that is marked as removed or suggested for removal.<br/> Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('del')}} |
| **`emphasis`** <br/> Used to stress or emphasize content, but not to suggest importance.<br/>Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('em')}} |
| [`figure`](/en-US/docs/Web/Accessibility/ARIA/Roles/figure_role) <br/>Container for a graphical document, images, code snippets, or example text. | {{HTMLElement('figure')}} |
| [`heading`](/en-US/docs/Web/Accessibility/ARIA/Roles/heading_role) <br/> A heading for a section of the page.<br/>The `aria-level` attribute is required to indicate the nesting level.<br/>See the [`heading` role](/en-US/docs/Web/Accessibility/ARIA/Roles/heading_role) for more information. | {{HTMLElement("Heading_Elements", "h1")}}, {{HTMLElement("Heading_Elements", "h2")}}, {{HTMLElement("Heading_Elements", "h3")}}, {{HTMLElement("Heading_Elements", "h4")}}, {{HTMLElement("Heading_Elements", "h5")}}, and {{HTMLElement("Heading_Elements", "h6")}} |
| **`image`** <br/>Container for a collection of elements that form an image. Synonym for `img` role. | {{HTMLElement('img')}} |
| [`img`](/en-US/docs/Web/Accessibility/ARIA/Roles/img_role) <br/>Container for a collection of elements that form an image. <br/>Accessible name is required. <br/>See the [`img` role](/en-US/docs/Web/Accessibility/ARIA/Roles/img_role) for more information. | {{HTMLElement('img')}} |
| **`insertion`** <br/>Content that is marked as added or content that is being suggested for addition.<br/> Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('ins')}} |
| [`list`](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role)<br/>A section containing `listitem` elements.<br/> See [`list` role](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role) for more information | {{HTMLElement('ol')}}<br/>{{HTMLElement('ul')}} |
| [`listitem`](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role)<br/>A single item in a `list` or `directory`.<br/>Must be contained in a `list` (like `<li>`).<br>See [`listitem` role](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role) for more information. | {{HTMLElement('li')}} |
| [`mark`](/en-US/docs/Web/Accessibility/ARIA/Roles/mark_role)<br/>Marked or highlighted for reference or notation purposes.<br>See [`mark` role](/en-US/docs/Web/Accessibility/ARIA/Roles/mark_role) for more information. | {{HTMLElement('mark')}} |
| [`meter`](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role) <br/>A scalar measurement within a known range, or a fractional value.<br/>Accessible name required. `aria-valuenow` required.<br/>See [`meter` role](/en-US/docs/Web/Accessibility/ARIA/Roles/meter_role) for more information. | {{HTMLElement('meter')}} |
| **`paragraph`** <br/>A paragraph of content.<br/> Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('p')}} |
| **`strong`** <br/>Important, serious, or urgent content.<br/> Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('strong')}} |
| **`subscript`** <br/>One or more subscripted characters.<br/>Only use if absence of role would change the content's meaning.<br/> Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('sub')}} |
| **`superscript`** <br/>One or more superscripted characters.<br/>Only use if absence of role would change the content's meaning.<br/> Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('sup')}} |
| [`term`](/en-US/docs/Web/Accessibility/ARIA/Roles/term_role)<br/>Word or phrase with an optional corresponding definition.<br/> Prohibited attributes: `aria-label` and `aria-labelledby`.<br/>See [`term` role](/en-US/docs/Web/Accessibility/ARIA/Roles/term_role) for more information. | {{HTMLElement('dfn')}} |
| **`time`** <br> A valid date or time string format list a specific point in time.<br/> Prohibited attributes: `aria-label` and `aria-labelledby`. | {{HTMLElement('time')}} |
> **Note:** The `aria-label` and `aria-labelledby` attributes are prohibited on `code`, `caption`, `deletion`, `emphasis`, `generic`, `insertion`, `mark`, `paragraph`, `presentation`, `none`, `strong`, `subscript`, `superscript`, `suggestion`, `term`, and `time`, and should only be used on interactive content.
## Best Practices
Do not use structural roles. Opt for HTML semantic elements instead.
## Specifications
{{Specifications}}
## See also
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/window_role/index.md | ---
title: "ARIA: window role"
slug: Web/Accessibility/ARIA/Roles/window_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#window
---
The `window` role defines a browser or app window.
> **Note:** The `window` role is an abstract role. It is included here for completeness of documentation. It should not be used by web authors.
## Description
The `window` role, an abstract role, is a superclass for roles defining a browser or app window. The sub-class roles, currently only the [`dialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role) role, have a window-like <abbr>GUI</abbr>, or graphical user interface, whether it's a full native window or just a section of a document styled to look like a window, where `role="dialog"` would be appropriate.
## Best Practices
Do not use.
## Specifications
{{Specifications}}
## See also
- [ARIA: `roletype` role](/en-US/docs/Web/Accessibility/ARIA/Roles/roletype_role)
- [ARIA: `dialog` role](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/search_role/index.md | ---
title: "ARIA: search role"
slug: Web/Accessibility/ARIA/Roles/search_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#search
- https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/search.html
---
The `search` role is used to identify the search functionality; the section of the page used to search the page, site, or collection of sites.
```html
<form role="search">
<!-- search input -->
</form>
```
## Description
The `search` role is [a landmark](/en-US/docs/Web/Accessibility/ARIA/Roles#3._landmark_roles) role that can be added to the container element that encompasses all of the elements that combined to form the search feature of the document or application, including a descendant [(`<input type="search">`)](/en-US/docs/Web/HTML/Element/input/search). If a document includes more than one search, each should have a unique label, unless they are the same search repeated, then use the same name. There is a [`input` of type `search`)](/en-US/docs/Web/HTML/Element/input/search), though this does not define a search landmark by itself. Using {{HTMLElement('search')}} is an alternative way to define a search landmark.
## Examples
When a {{HTMLElement('form')}} is a search form, use the `search` role instead of [`form`](/en-US/docs/Web/Accessibility/ARIA/Roles/form_role) role.
```HTML
<form id="search" role="search">
<label for="search-input">Search this site</label>
<input type="search" id="search-input" name="search" spellcheck="false">
<input value="Submit" type="submit">
</form>
```
## Accessibility concerns
[Landmark roles](/en-US/docs/Web/Accessibility/ARIA/Roles#3._landmark_roles) are intended to be used sparingly, to identify larger overall sections of the document. Using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page.
## Best practices
### Prefer HTML
Using the {{HTMLElement('form')}} element in conjunction with a declaration of `role="search"` will provide the largest amount of support.
### Labeling landmarks
#### Multiple landmarks
If there is more than one `search` landmark role in a document, provide a label for each landmark. This label will allow an assistive technology user to be able to quickly understand the purpose of each landmark.
```html
<form id="site-search" role="search" aria-label="Sitewide">
<!-- search input -->
</form>
…
<form id="page-search" role="search" aria-label="On this page">
<!-- search input -->
</form>
```
#### Repeated landmarks
If a `search` landmark role in a document is repeated in a document, and both landmarks have identical content, use the same label for each landmark. An example of this would be repeating the sitewide search at the top and bottom of the page.
```html
<header>
<form id="site-search-top" role="search" aria-label="Sitewide">
<!-- search input -->
</form>
</header>
…
<footer>
<form id="site-search-bottom" role="search" aria-label="Sitewide">
<!-- search input -->
</form>
</footer>
```
#### Redundant descriptions
Screen readers will announce the type of role the landmark is. Because of this, you do not need to describe what the landmark is in its label. For example, a declaration of `role="search"` with an [`aria-label="Sitewide search"`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) may be announced redundantly as, "sitewide search search".
## Specifications
{{Specifications}}
## See also
- The {{HTMLElement('form')}} element
- The {{HTMLElement('input')}} element
- The {{HTMLElement('search')}} element
- [`<input type="search">`](/en-US/docs/Web/HTML/Element/input/search)
- [Using HTML sections and outlines](/en-US/docs/Web/HTML/Element/Heading_Elements)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/status_role/index.md | ---
title: "ARIA: status role"
slug: Web/Accessibility/ARIA/Roles/status_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#status
---
The `status` role defines a [live region](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) containing advisory information for the user that is not important enough to be an [`alert`](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role).
## Description
A `status` is a type of [live region](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) providing advisory information that is not important enough to justify an alert, which would immediately interrupt the announcement of a user's current activity. It is often, but not necessarily, presented as a status bar.
Do not give focus to the status when its content updates. Live regions are meant to inform users of dynamic updates that have occurred in other areas of the current web page, but which do not necessitate interrupting the user's current activity with a change in context. If a situation requires that focus needs to be moved, then using a `status`, or other live region, are likely not appropriate.
Elements with the role status have an implicit [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live) value of `polite` and an implicit [`aria-atomic`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic) value of `true`.
### Associated WAI-ARIA roles, states, and properties
- [`aria-atomic`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-atomic)
- : Defines whether assistive technologies should present all, or only parts of, the changed region. Elements with the role `status` have an implicit [aria-atomic](https://www.w3.org/TR/wai-aria-1.1/#aria-atomic) value of `true`.
- [`aria-live`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live)
- : Defines when assistive technology should inform the user of updates to content. Elements with the role `status` have an implicit [aria-live](https://www.w3.org/TR/wai-aria-1.1/#aria-live) value of `polite`, meaning screen readers will announce changes inside the log when the user is idle.
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) or [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : Some screen readers announce the name of a status element before announcing its contents. If a name is visible, reference it using `aria-labelledby`. Including an `aria-label` provides a method for prefacing the visible content of a status element with text that is not displayed when a screen reader reads the content. Naming a status is not required so if nothing is appropriate both these attributes can be omitted.
## Specifications
{{Specifications}}
## See also
- [ARIA: `alert` role](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)
- [ARIA: `log` role](/en-US/docs/Web/Accessibility/ARIA/Roles/log_role)
- [ARIA: `marquee` role](/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role)
- [ARIA: `timer` role](/en-US/docs/Web/Accessibility/ARIA/Roles/timer_role)
- [ARIA live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/log_role/index.md | ---
title: "ARIA: log role"
slug: Web/Accessibility/ARIA/Roles/log_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#log
---
The `log` role is used to identify an element that creates a [live region](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) where new information is added in a meaningful order and old information may disappear.
## Description
A log is a type of live region where new information is added in meaningful order and old information may disappear. Examples include chat logs, messaging history, game log, or an error log. In contrast to other live regions, in this role there is a relationship between the arrival of new items in the log and the reading order. The log contains a meaningful sequence and new information is added only to the end of the log, not at arbitrary points.
In contrast to other types of live region, a log is sequentially ordered and new information is only added to the end of the log. When this role is added to an element, the browser will send out an accessible log event to assistive technology products which can then notify the user about it.
By default, updates contain only the changes to the live region and these are announced when the user is idle. Elements with the role `log` have an implicit `aria-live` value of `polite`. Where the user needs to hear the entire live region upon a change `aria-atomic="true"` should be set. To have announcements made as soon as possible and where the user may be interrupted, `aria-live="assertive"` can be set for more aggressive updates.
### Associated WAI-ARIA roles, states, and properties
- `aria-atomic`
- : Defines whether assistive technologies should present all, or only parts of, the changed region. Elements with the role `log` have an implicit [aria-atomic](https://www.w3.org/TR/wai-aria-1.1/#aria-atomic) value of `false`.
- `aria-live`
- : Defines when assistive technology should inform the user of updates to content. Elements with the role `log` have an implicit [aria-live](https://www.w3.org/TR/wai-aria-1.1/#aria-live) value of `polite`, meaning screen readers will announce changes inside the log when the user is idle.
- `aria-label` and `aria-labelledby`
- : The `log` is required to have an accessible name. Use `aria-labelledby` if a visible label is present, otherwise use `aria-label`.
## Best Practices
With an area that has scrolling text, such as a stock ticker, the [`marquee`](/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role) role should be used instead.
## Specifications
{{Specifications}}
## See also
- [ARIA: `alert` role](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)
- [ARIA: `marquee` role](/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role)
- [ARIA: `status` role](/en-US/docs/Web/Accessibility/ARIA/Roles/status_role)
- [ARIA: `timer` role](/en-US/docs/Web/Accessibility/ARIA/Roles/timer_role)
- [ARIA live regions](/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/grid_role/index.md | ---
title: "ARIA: grid role"
slug: Web/Accessibility/ARIA/Roles/grid_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#grid
---
The grid role is for a widget that contains one or more rows of cells. The position of each cell is significant and can be focused using keyboard input.
## Description
The `grid` role is a composite widget containing a collection of one or more rows with one or more cells where some or all cells in the grid are focusable by using methods of two-dimensional navigation, such as directional arrow keys.
```html
<table role="grid" aria-labelledby="id-select-your-seat">
<caption id="id-select-your-seat">
Select your seat
</caption>
<tbody role="presentation">
<tr role="presentation">
<td></td>
<th>Row A</th>
<th>Row B</th>
</tr>
<tr>
<th scope="row">Aisle 1</th>
<td tabindex="0">
<button id="1a" tabindex="-1">1A</button>
</td>
<td tabindex="-1">
<button id="1b" tabindex="-1">1B</button>
</td>
<!-- More Columns -->
</tr>
<tr>
<th scope="row">Aisle 2</th>
<td tabindex="-1">
<button id="2a" tabindex="-1">2A</button>
</td>
<td tabindex="-1">
<button id="2b" tabindex="-1">2B</button>
</td>
<!-- More Columns -->
</tr>
</tbody>
</table>
```
A grid widget contains one or more rows with one or more cells of thematically related interactive content. While it does not imply a specific visual presentation, it implies a relationship among elements. Uses fall into two categories: presenting tabular information (data grids) and grouping other widgets (layout grids). Even though both data grids and layout grids employ the same ARIA roles, states, and properties, differences in their content and purpose surface factors that are important to consider in keyboard interaction design. See [ARIA Authoring Practices Guide](https://www.w3.org/WAI/ARIA/apg/patterns/grid/) for more details.
Cell elements have the role [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role), unless they are a row or column header. Then the elements are [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role) and [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role), respectively. Cell elements need to be owned by elements with a [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role) role. Rows can be grouped using `rowgroups`.
If the grid is used as an interactive widget, [keyboard interactions](#keyboard_interactions) need to be implemented.
### Associated ARIA roles, states, and properties
#### Roles
- [treegrid](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role) (subclass)
- : If a grid has columns that can expanded or collapsed, a treegrid can be used.
- [row](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- : A row inside the grid.
- [rowgroup](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role)
- : A group containing one or multiple [row](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)s.
#### States and properties
- [aria-level](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level)
- : Indicates the hierarchical level of the grid within other structures.
- [aria-multiselectable](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable)
- : If `aria-multiselectable` is set to `true`, multiple items in the grid can be selected. The default value is `false`.
- [aria-readonly](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly)
- : If the user can navigate the grid but not change the value or values of the grid, the [`aria-readonly`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly) should be set to `true`. The default value is `false`.
> **Note:** For many use cases, an HTML {{HTMLElement('table')}} element is sufficient as it and the various table elements already include many ARIA roles.
### Keyboard interactions
When a keyboard user encounters a grid, they navigate the rows and columns using the <kbd>left</kbd>, <kbd>right</kbd>, <kbd>top</kbd> and <kbd>down</kbd> keys. To activate the interactive component, they will use the <kbd>return</kbd> and <kbd>space</kbd> keys.
| Key | Action |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <kbd>→</kbd> | Moves focus one cell to the right. Optionally (layout grids), if focus is on the right-most cell in the row, focus may move to the first cell in the following row. If focus is on the last cell in the grid, focus does not move. |
| <kbd>←</kbd> | Moves focus one cell to the left. Optionally (layout grids), if focus is on the left-most cell in the row, focus may move to the last cell in the previous row. If focus is on the first cell in the grid, focus does not move. |
| <kbd>↓</kbd> | Moves focus one cell down. Optionally (layout grids), if focus is on the bottom cell in the column, focus may move to the top cell in the following column. If focus is on the last cell in the grid, focus does not move. |
| <kbd>↑</kbd> | Moves focus one cell up. Optionally (layout grids), if focus is on the top cell in the column, focus may move to the bottom cell in the previous column. If focus is on the first cell in the grid, focus does not move. |
| <kbd>Page Down</kbd> | Moves focus down an author-determined number of rows, typically scrolling so the bottom row in the currently visible set of rows becomes one of the first visible rows. If focus is in the last row of the grid, focus does not move. |
| <kbd>Page Up</kbd> | Moves focus up an author-determined number of rows, typically scrolling so the top row in the currently visible set of rows becomes one of the last visible rows. If focus is in the first row of the grid, focus does not move. |
| <kbd>Home</kbd> | Moves focus to the first cell in the row that contains focus. |
| <kbd>End</kbd> | Moves focus to the last cell in the row that contains focus. |
| <kbd>ctrl</kbd> + <kbd>Home</kbd> | Moves focus to the first cell in the first row. |
| <kbd>ctrl</kbd> + <kbd>End</kbd> | Moves focus to the last cell in the last row. |
If cells, rows, or columns can be selected, the following key combination are commonly used:
| Key combination | Action |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <kbd>ctrl</kbd> + <kbd>Space</kbd> | Select the column that contains the focus. |
| <kbd>shift</kbd> + <kbd>Space</kbd> | Selects the row that contains the focus. If the grid includes a column with checkboxes to select rows, this key combination can be used to check that box even if the focus is not on the checkbox. |
| <kbd>ctrl</kbd> + <kbd>A</kbd> | Selects all cells. |
| <kbd>shift</kbd> + <kbd>→</kbd> | Extends selection one cell to the right. |
| <kbd>shift</kbd> + <kbd>←</kbd> | Extends selection one cell to the left. |
| <kbd>shift</kbd> + <kbd>↓</kbd> | Extends selection one cell down. |
| <kbd>shift</kbd> + <kbd>↑</kbd> | Extends selection one cell up. |
## Examples
### Calendar example
{{EmbedLiveSample("Calendar_example", "100%", "300")}}
#### HTML
```html
<table role="grid" aria-labelledby="calendarheader">
<caption id="calendarheader">
September 2018
</caption>
<thead role="rowgroup">
<tr role="row">
<td></td>
<th role="columnheader" aria-label="Sunday">S</th>
<th role="columnheader" aria-label="Monday">M</th>
<th role="columnheader" aria-label="Tuesday">T</th>
<th role="columnheader" aria-label="Wednesday">W</th>
<th role="columnheader" aria-label="Thursday">T</th>
<th role="columnheader" aria-label="Friday">F</th>
<th role="columnheader" aria-label="Saturday">S</th>
</tr>
</thead>
<tbody role="rowgroup">
<tr role="row">
<th scope="row" role="rowheader">Week 1</th>
<td>26</td>
<td>27</td>
<td>28</td>
<td>29</td>
<td>30</td>
<td>31</td>
<td role="gridcell" tabindex="-1">1</td>
</tr>
<tr role="row">
<th scope="row" role="rowheader">Week 2</th>
<td role="gridcell" tabindex="-1">2</td>
<td role="gridcell" tabindex="-1">3</td>
<td role="gridcell" tabindex="-1">4</td>
<td role="gridcell" tabindex="-1">5</td>
<td role="gridcell" tabindex="-1">6</td>
<td role="gridcell" tabindex="-1">7</td>
<td role="gridcell" tabindex="-1">8</td>
</tr>
<tr role="row">
<th scope="row" role="rowheader">Week 3</th>
<td role="gridcell" tabindex="-1">9</td>
<td role="gridcell" tabindex="-1">10</td>
<td role="gridcell" tabindex="-1">11</td>
<td role="gridcell" tabindex="-1">12</td>
<td role="gridcell" tabindex="-1">13</td>
<td role="gridcell" tabindex="-1">14</td>
<td role="gridcell" tabindex="-1">15</td>
</tr>
<tr role="row">
<th scope="row" role="rowheader">Week 4</th>
<td role="gridcell" tabindex="-1">16</td>
<td role="gridcell" tabindex="-1">17</td>
<td role="gridcell" tabindex="-1">18</td>
<td role="gridcell" tabindex="-1">19</td>
<td role="gridcell" tabindex="-1">20</td>
<td role="gridcell" tabindex="-1">21</td>
<td role="gridcell" tabindex="-1">22</td>
</tr>
<tr role="row">
<th scope="row" role="rowheader">Week 5</th>
<td role="gridcell" tabindex="-1">23</td>
<td role="gridcell" tabindex="-1">24</td>
<td role="gridcell" tabindex="-1">25</td>
<td role="gridcell" tabindex="-1">26</td>
<td role="gridcell" tabindex="-1">27</td>
<td role="gridcell" tabindex="-1">28</td>
<td role="gridcell" tabindex="-1">29</td>
</tr>
<tr role="row">
<th scope="row" role="rowheader">Week 6</th>
<td role="gridcell" tabindex="-1">30</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
</tbody>
</table>
```
#### CSS
```css
table {
margin: 0;
border-collapse: collapse;
font-variant-numeric: tabular-nums;
}
tbody th,
tbody td {
padding: 5px;
}
tbody td {
border: 1px solid #000;
text-align: right;
color: #767676;
}
tbody td[role="gridcell"] {
color: #000;
}
tbody td[role="gridcell"]:hover,
tbody td[role="gridcell"]:focus {
background-color: #f6f6f6;
outline: 3px solid blue;
}
```
#### JavaScript
```js
const selectables = document.querySelectorAll('table td[role="gridcell"]');
selectables[0].setAttribute("tabindex", 0);
const trs = document.querySelectorAll("table tbody tr");
let row = 0;
let col = 0;
let maxrow = trs.length - 1;
let maxcol = 0;
trs.forEach((gridrow) => {
gridrow.querySelectorAll("td").forEach((el) => {
el.dataset.row = row;
el.dataset.col = col;
col++;
});
if (col > maxcol) {
maxcol = col - 1;
}
col = 0;
row++;
});
function moveto(newrow, newcol) {
const tgt = document.querySelector(
`[data-row="${newrow}"][data-col="${newcol}"]`,
);
if (tgt?.getAttribute("role") === "gridcell") {
document.querySelectorAll("[role=gridcell]").forEach((el) => {
el.setAttribute("tabindex", "-1");
});
tgt.setAttribute("tabindex", "0");
tgt.focus();
return true;
} else {
return false;
}
}
document.querySelector("table").addEventListener("keydown", (event) => {
const col = parseInt(event.target.dataset.col, 10);
const row = parseInt(event.target.dataset.row, 10);
switch (event.key) {
case "ArrowRight": {
const newrow = col === 6 ? row + 1 : row;
const newcol = col === 6 ? 0 : col + 1;
moveto(newrow, newcol);
break;
}
case "ArrowLeft": {
const newrow = col === 0 ? row - 1 : row;
const newcol = col === 0 ? 6 : col - 1;
moveto(newrow, newcol);
break;
}
case "ArrowDown":
moveto(row + 1, col);
break;
case "ArrowUp":
moveto(row - 1, col);
break;
case "Home": {
if (event.ctrlKey) {
let i = 0;
let result;
do {
let j = 0;
do {
result = moveto(i, j);
j++;
} while (!result);
i++;
} while (!result);
} else {
moveto(row, 0);
}
break;
}
case "End": {
if (event.ctrlKey) {
let i = maxrow;
let result;
do {
let j = maxcol;
do {
result = moveto(i, j);
j--;
} while (!result);
i--;
} while (!result);
} else {
moveto(
row,
document.querySelector(
`[data-row="${event.target.dataset.row}"]:last-of-type`,
).dataset.col,
);
}
break;
}
case "PageUp": {
let i = 0;
let result;
do {
result = moveto(i, col);
i++;
} while (!result);
break;
}
case "PageDown": {
let i = maxrow;
let result;
do {
result = moveto(i, col);
i--;
} while (!result);
break;
}
case "Enter": {
console.log(event.target.textContent);
break;
}
}
event.preventDefault();
});
```
### More examples
- [Data Grid Examples](https://www.w3.org/WAI/ARIA/apg/example-index/grid/dataGrids.html)
- [Layout Grids Examples](https://www.w3.org/WAI/ARIA/apg/example-index/grid/LayoutGrids.html)
- [W3C/WAI Tutorial: Tables](https://www.w3.org/WAI/tutorials/tables/)
## Accessibility concerns
Even if the keyboard use is properly implemented, some users might not be aware that they have to use the arrow keys. Make sure that the functionality and interaction needed can be best achieved using the grid role.
## Specifications
{{Specifications}}
## See also
- [ARIA `composite` role](/en-US/docs/Web/Accessibility/ARIA/Roles/composite_role)
- [ARIA `table` role](/en-US/docs/Web/Accessibility/ARIA/Roles/table_role)
- [ARIA `treegrid` role](/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role)
- [ARIA `row` role](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- [ARIA `rowgroup` role](/en-US/docs/Web/Accessibility/ARIA/Roles/rowgroup_role)
- [ARIA: `gridcell` role](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [ARIA: `rowheader` role](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [ARIA: columnheader role](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- {{HTMLElement('table','HTML <code><table></code> element')}}
- [`aria-level`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-level)
- [`aria-multiselectable`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable)
- [`aria-readonly`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/button_role/index.md | ---
title: "ARIA: button role"
slug: Web/Accessibility/ARIA/Roles/button_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#button
- https://www.w3.org/WAI/ARIA/apg/patterns/button/examples/button/
---
The `button` role is for clickable elements that trigger a response when activated by the user. Adding `role="button"` tells the screen reader the element is a button, but provides no button functionality. Use {{HTMLElement("button")}} or {{HTMLElement("input")}} with `type="button"` instead.
## Description
The button role identifies an element as a button to assistive technology such as screen readers. A button is a widget used to perform actions such as submitting a form, opening a dialog, canceling an action, or performing a command such as inserting a new record or displaying information. Adding `role="button"` tells assistive technology that the element is a button but provides no button functionality. Use {{HTMLElement("button")}} or {{HTMLElement("input")}} with `type="button"` instead.
This `button` role can be used in combination with the [`aria-pressed`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed) attribute to [create toggle buttons](#toggle_buttons).
```html
<div id="saveChanges" tabindex="0" role="button" aria-pressed="false">Save</div>
```
The above example creates a focusable button, but requires JavaScript and CSS to include button appearance and functionality. These are features provided by default when using the {{HTMLElement("button")}} and {{HTMLElement("input")}} with `type="button"` elements:
```html
<button type="button" id="saveChanges">Save</button>
```
> **Note:** If using `role="button"` instead of the semantic `<button>` or `<input type="button">` elements, you will need to make the element focusable and define event handlers for {{domxref("Element/click_event", "click")}} and {{domxref("Element/keydown_event", "keydown")}} events. This includes handling the <kbd>Enter</kbd> and <kbd>Space</kbd> keypresses in order to process all forms of user input. See [the official WAI-ARIA example code](https://www.w3.org/WAI/ARIA/apg/patterns/button/examples/button/).
In addition to the ordinary button widget, `role="button"` should be included when creating a toggle button or menu button using a non-button element.
A toggle button is a two-state button that can be either off (not pressed) or on (pressed). The [`aria-pressed`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed) attribute values of `true` or `false` identify a button as a toggle button.
A menu button is a button that controls a menu and has an [`aria-haspopup`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup) property attribute set to either `menu` or `true`.
### All descendants are presentational
There are some types of user interface components that, when represented in a platform accessibility API, can only contain text. Accessibility APIs do not have a way of representing semantic elements contained in a `button`. To deal with this limitation, browsers, automatically apply role [`presentation`](/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role) to all descendant elements of any `button` element as it is a role that does not support semantic children.
For example, consider the following `button` element, which contains a heading.
```html
<div role="button"><h3>Title of my button</h3></div>
```
Because descendants of `button` are presentational, the following code is equivalent:
```html
<div role="button"><h3 role="presentation">Title of my button</h3></div>
```
From the assistive technology user's perspective, the heading does not exist since the previous code snippets are equivalent to the following in the [accessibility tree](/en-US/docs/Glossary/Accessibility_tree):
```html
<div role="button">Title of my button</div>
```
### Associated ARIA roles, states, and properties
- [`aria-pressed`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed)
- : The `aria-pressed` attribute defines the button as a toggle button. The value describes the state of the button. The values include `aria-pressed="false"` when a button is not currently pressed, `aria-pressed="true"` to indicate a button is currently pressed, and `aria-pressed="mixed"` if the button is considered to be partially pressed. If the attribute is omitted or set to its default value of `aria-pressed="undefined"`, the element does not support being pressed.
- [`aria-expanded`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded)
- : If the button controls a grouping of other elements, the `aria-expanded` state indicates whether the controlled grouping is currently expanded or collapsed. If the button has `aria-expanded="false"` set, the grouping is not currently expanded; If the button has `aria-expanded="true"` set, it is currently expanded; if the button has `aria-expanded="undefined"` set or the attribute is omitted, it is not expandable.
### Basic buttons
Buttons should always have an accessible name. For most buttons, this name will be the same as the text inside the button, between the opening and closing tags. In some cases, for example buttons represented by icons, the accessible name may be provided from the [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) or [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) attributes.
### Toggle buttons
A toggle button typically has two states: pressed and not pressed. A third mixed state is available for toggle buttons that control other elements, such as other toggle buttons or checkboxes, which do not all share the same value. Whether an element is a toggle button or not can be indicated with the [`aria-pressed`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed) attribute in addition to the `button` role (if the element is not already a native button element):
- If `aria-pressed` is not used, or is set to the "undefined" state, the button is not a toggle button.
- If `aria-pressed="false"` is used the button is a toggle button that is currently not pressed.
- If `aria-pressed="true"` is used the button is a toggle button that is currently pressed.
- if `aria-pressed="mixed"` is used, the button is considered to be partially pressed.
As an example, the mute button on an audio player labeled "mute" could indicate that sound is muted by setting the `aria-pressed` state true. The label of a toggle button should not change when its state changes. In our example the label remains "Mute" with a screen reader reading "Mute toggle button pressed" or "Mute toggle button not pressed" depending on the value of `aria-pressed`. If the design were to call for the button label to change from "Mute" to "Unmute," a toggle button would not be appropriate, so the `aria-pressed` attribute would be omitted.
### Keyboard interactions
| Key | Function |
| ---------------- | --------------------- |
| <kbd>Enter</kbd> | Activates the button. |
| <kbd>Space</kbd> | Activates the button |
Following button activation, focus is set depending on the type of action the button performs. For example, if clicking the button opens a dialog, the focus should move to the dialog. If the button closes a dialog, focus should return to the button that opened the dialog unless the function performed in the dialog context logically leads to a different element. If the button alters the current context, such as muting and unmuting an audio file, then focus typically remains on the button.
### Required JavaScript Features
#### Required event handlers
Buttons can be operated by mouse, touch, and keyboard users. For native HTML `<button>` elements, the button's `onclick` event fires for mouse clicks and when the user presses <kbd>Space</kbd> or <kbd>Enter</kbd> while the button has focus. But if another tag is used to create a button, the `onclick` event only fires when clicked by the mouse cursor, even if `role="button"` is used. Because of this, separate key event handlers must be added to the element so that the button is be triggered when the <kbd>Space</kbd> or <kbd>Enter</kbd> key is pressed.
- `onclick`
- : Handles the event raised when the button is activated using a mouse click or touch event.
- `onKeyDown`
- : Handles the event raised when the button is activated using the Enter or Space key on the keyboard. (Note not the [deprecated onKeyPress](/en-US/docs/Web/API/Element/keypress_event))
## Examples
### Basic button example
In this example, a span element has been given the `button` role. Because a `<span>` element is used, the `tabindex` attribute is required to make the button focusable and part of the page's tab order. The included CSS style is provided to make the `<span>` element look like a button, and to provide visual cues when the button has focus.
The `handleBtnClick` and `handleBtnKeyDown` event handlers perform the button's action when activated using a mouse click or the <kbd>Space</kbd> or <kbd>Enter</kbd> key. In this case, the action is to add a new name to the list of names.
Try the example by adding a name to the text box. The button will cause the name to be added to a list.
#### HTML
```html
<h1>ARIA Button Example</h1>
<ul id="nameList"></ul>
<label for="newName">Enter your Name: </label>
<input type="text" id="newName" />
<span
role="button"
tabindex="0"
onclick="handleCommand(event)"
onKeyDown="handleCommand(event)"
>Add Name</span
>
```
#### CSS
```css
[role="button"] {
padding: 2px;
background-color: navy;
color: white;
cursor: default;
}
[role="button"]:hover,
[role="button"]:focus,
[role="button"]:active {
background-color: white;
color: navy;
}
ul {
list-style: none;
}
```
#### JavaScript
```js
function handleCommand(event) {
// Handles both mouse clicks and keyboard
// activate with Enter or Space
// Keypresses other then Enter and Space should not trigger a command
if (
event instanceof KeyboardEvent &&
event.key !== "Enter" &&
event.key !== " "
) {
return;
}
// Get the new name value from the input element
const newNameInput = document.getElementById("newName");
const name = newNameInput.value;
newNameInput.value = ""; // clear the text field
newNameInput.focus(); // give the text field focus to enable entering and additional name.
// Don't add blank entries to the list.
if (name.length > 0) {
const listItem = document.createElement("li");
listItem.appendChild(document.createTextNode(name));
// Add the new name to the list.
const list = document.getElementById("nameList");
list.appendChild(listItem);
}
}
```
{{EmbedLiveSample("Basic_button_example")}}
### Toggle button example
In this snippet a {{HTMLElement("span")}} element is converted to a toggle button using the `button` role and the `aria-pressed` attribute. When the button is activated, the `aria-pressed` value switches states; changing from `true` to `false` and back again.
#### HTML
```html
<button
type="button"
onclick="handleBtnClick(event)"
onKeyDown="handleBtnKeyDown(event)">
Mute Audio
</button>
<span
role="button"
tabindex="0"
aria-pressed="false"
onclick="handleBtnClick(event)"
onKeyDown="handleBtnKeyDown(event)">
Mute Audio
</span>
<audio
id="audio"
src="https://soundbible.com/mp3/Tyrannosaurus%20Rex%20Roar-SoundBible.com-807702404.mp3">
Your browser does not support the `audio` element.
</audio>
```
#### CSS
```css
button,
[role="button"] {
padding: 3px;
border: 2px solid transparent;
}
button:active,
button:focus,
[role="button"][aria-pressed="true"] {
border: 2px solid #000;
}
```
#### JavaScript
```js
function handleBtnClick(event) {
toggleButton(event.target);
}
function handleBtnKeyDown(event) {
// Check to see if space or enter were pressed
// "Spacebar" for IE11 support
if (event.key === " " || event.key === "Enter" || event.key === "Spacebar") {
// Prevent the default action to stop scrolling when space is pressed
event.preventDefault();
toggleButton(event.target);
}
}
function toggleButton(element) {
const audio = document.getElementById("audio");
// Check to see if the button is pressed
const pressed = element.getAttribute("aria-pressed") === "true";
// Change aria-pressed to the opposite state
element.setAttribute("aria-pressed", !pressed);
// Toggle the play state of the audio file
if (pressed) {
audio.pause();
} else {
audio.play();
}
}
```
#### Result
{{EmbedLiveSample('Toggle_button_example')}}
## Accessibility concerns
Buttons are interactive controls and thus focusable. If the `button` role is added to an element that is not focusable by itself (such as `<span>`, `<div>` or `<p>`) then, the `tabindex` attribute has to be used to make the button focusable.
> **Warning:** Be careful when marking up links with the button role. Buttons are expected to be triggered using the <kbd>Space</kbd> or <kbd>Enter</kbd> key, while links are expected to be triggered using the <kbd>Enter</kbd> key. In other words, when links are used to behave like buttons, adding `role="button"` alone is not sufficient. It will also be necessary to add a key event handler that listens for the <kbd>Space</kbd> key in order to be consistent with native buttons.
When the `button` role is used, screen readers announce the element as a button, generally saying "click" followed by the button's accessible name. The accessible name is either the content of the element or the value of an `aria-label` or element referenced by an `aria-labelledby` attribute, or description, if included.
## Best practices
If a link performs the action of a button, giving the element `role="button"` helps assistive technology users understand the function of the element. However, a better solution is to adjust the visual design so it matches the function and ARIA role. Where possible, it is recommended to use native HTML buttons (`<button>`, `<input type="button">`, `<input type="submit">`, `<input type="reset">` and `<input type="image">`) rather than the `button` role, as native HTML buttons are supported by all user agents and assistive technology and provide keyboard and focus requirements by default, without need for additional customization.
## Specifications
{{Specifications}}
## See also
- The {{HTMLElement('button')}} element
- The {{HTMLElement("input")}} element
- [`<input type="button">`](/en-US/docs/Web/HTML/Element/input/button)
- [`<input type="submit">`](/en-US/docs/Web/HTML/Element/input/submit)
- [`<input type="reset">`](/en-US/docs/Web/HTML/Element/input/reset)
- [`aria-pressed`](https://www.w3.org/TR/wai-aria-1.1/#aria-pressed)
- [`aria-expanded`](https://www.w3.org/TR/wai-aria-1.1/#aria-expanded)
- [`aria-haspopup`](https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup)
- [Strong native semantics in HTML5](https://html.spec.whatwg.org/multipage/dom.html#aria-usage-note)
- [Notes on Using ARIA in HTML](https://www.w3.org/TR/aria-in-html/)
- [Official WAI-ARIA example code](https://www.w3.org/WAI/ARIA/apg/patterns/button/examples/button/)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/sectionhead_role/index.md | ---
title: "ARIA: sectionhead role"
slug: Web/Accessibility/ARIA/Roles/sectionhead_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#sectionhead
---
The **`sectionhead` role**, an abstract role, is superclass role for labels or summaries of the topic of its related section.
> **Note:** The `sectionhead` role is an [abstract role](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles). It is included here for completeness of documentation. It should not be used by web authors.
## Description
The structural `sectionhead` role is an abstract role for the subclass roles that identify the labels or summaries of the sections they label. The role must not be used. The four subclasses — [`columnheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role), [`heading`](/en-US/docs/Web/Accessibility/ARIA/Roles/heading_role), [`rowheader`](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role), and [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role). There are HTML element equivalents, like, {{HTMLElement('th', '<code><th scope="col"></code>')}} for `columnheader`, {{HTMLElement('th', '<code><th scope="row"></code>')}} for rowheader, and any of the HTML headings, {{HTMLElement("Heading_Elements", "h1")}} through {{HTMLElement("Heading_Elements", "h6")}} for `heading`. The `tab` role does not currently have an HTML equivalent.
## Best Practices
Do not use.
## Specifications
{{Specifications}}
## See also
- [ARIA: `structure` role](/en-US/docs/Web/Accessibility/ARIA/Roles/structure_role)
- [ARIA: `columnheader` role](/en-US/docs/Web/Accessibility/ARIA/Roles/columnheader_role)
- [ARIA: `heading` role](/en-US/docs/Web/Accessibility/ARIA/Roles/heading_role)
- [ARIA: `rowheader` role](/en-US/docs/Web/Accessibility/ARIA/Roles/rowheader_role)
- [ARIA: `tab` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/figure_role/index.md | ---
title: "ARIA: figure role"
slug: Web/Accessibility/ARIA/Roles/figure_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#figure
---
The ARIA `figure` role can be used to identify a figure inside page content where appropriate semantics do not already exist. A figure is generally considered to be one or more images, code snippets, or other content that puts across information in a different way to a regular flow of text.
## Description
A `figure` is a perceivable section of content that typically contains a graphical document, images, code snippets, or example text. The parts of a figure MAY be user-navigable. Any content that should be grouped together and consumed as a figure (which could include images, video, audio, code snippets, or other content) can be identified as a figure using `role="figure"`.
```html
<div role="figure" aria-labelledby="caption">
<img src="image.png" alt="put image description here" />
<p id="caption">Figure 1: The caption</p>
</div>
```
In the above example, we have a figure that consists of two separate content items — an image and a caption. This is wrapped by a {{htmlelement("div")}} element that identifies the content as a figure using `role="figure"`.
For HTML, use the {{HTMLElement('figure')}} and {{HTMLElement('figcaption')}} elements. The figcaption will serve as the accessible name for the figure. When not using HTML, or when retrofitting legacy HTML, use the [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) on the figure, pointing to the figure's caption.
If there is no visible caption, [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) can be used.
```html
<div role="figure" aria-labelledby="figure-1">
…
<p id="figure-1">Text that describes the figure.</p>
</div>
```
- Use `aria-labelledby` when the text is a concise label.
- Use [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby) when the text is a longer description.
- Use [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) when there is no visible figure caption.
This can be done semantically, without ARIA, with HTML's {{HTMLElement('figure')}} element along with {{HTMLElement('figcaption')}}.
```html
<figure>
<img src="image.png" alt="put image description here" />
<figcaption>Figure 1: The caption</figcaption>
</figure>
```
> **Note:** If at all possible in your work, you should use the appropriate semantic HTML elements to mark up a figure and its caption — {{htmlelement("figure")}} and {{htmlelement("figcaption")}}.
### Associated WAI-ARIA roles, states, and properties
- [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby)
- : The id of an element containing reference text serving as a caption.
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : The id of an element containing text serving as a label.
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- : If there is no element containing text that could serve as a label, you can add the label directly as a value on the `aria-label` on the element with the `figure` role or on the `<figure>` element.
### Keyboard interactions
No role specific keyboard interactions.
### Required JavaScript features
No role specific JavaScript requirements. If you don't have control over the HTML semantics, you can improve the accessibility of HTML by adding these roles and properties with JavaScript.
## Examples
We could extend the initial example on the page to also identify a paragraph that provides a descriptive label for the figure by referencing its ID in `aria-labelledby`:
```html
<div role="figure" aria-labelledby="figure-1">
<img
src="diagram.png"
alt="diagram showing the four layers of awesome and their relative priority order —
music, cats, nature, and ice cream" />
<pre>
`
let awesome = ['music', 'cats', 'nature', 'ice cream'];
`</pre
>
<p id="figure-1">Figure 1: The four layers of awesome.</p>
</div>
```
## Best practices
Only use `role="figure"` if you have to — for example if you don't have control over your HTML but are able to improve accessibility dynamically after the fact with JavaScript.
If at all possible, you should use the appropriate semantic HTML elements to mark up a figure and its caption — {{htmlelement("figure")}} and {{htmlelement("figcaption")}}. For example, our above example should be rewritten as follows:
```html
<figure>
<img
src="diagram.png"
alt="diagram showing the four layers of awesome and their relative priority order —
music, cats, nature, and ice cream" />
<pre>
`
let awesome = ['music', 'cats', 'nature', 'ice cream'];
`</pre
>
<figcaption>Figure 1: The four layers of awesome.</figcaption>
</figure>
```
## Specifications
{{Specifications}}
## See also
- [Accessibility Object Model](https://wicg.github.io/aom/spec/)
- [ARIA in HTML](https://w3c.github.io/html-aria/)
- [HTML `<figure>` element](/en-US/docs/Web/HTML/Element/figure)
- [HTML `<figcaption>` element](/en-US/docs/Web/HTML/Element/figcaption)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/alertdialog_role/index.md | ---
title: "ARIA: alertdialog role"
slug: Web/Accessibility/ARIA/Roles/alertdialog_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#alertdialog
- https://www.w3.org/TR/wai-aria-1.2/#alertdialog
---
The **alertdialog** role is to be used on modal alert dialogs that interrupt a user's workflow to communicate an important message and require a response.
## Description
The `alertdialog` role is used to notify users of urgent information that demands the user's immediate attention. Including `role="alertdialog"` on the element containing the dialog helps assistive technology identify the content as being grouped and separated from the rest of the page content. Examples include error messages that require confirmation and other action confirmation prompts.
As the name implies, `alertdialog` is a mashup of the [`dialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role) and [`alert`](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role) roles. `alertdialog` is a type of `dialog` with similar use cases as `alert`, but for when a user response is required.
> **Note:** The `alertdialog` role should only be used for alert messages that have associated interactive controls. If an alert dialog only contains static content and has no interactive controls at all, use [`alert`](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role) instead.
Being a type of dialog, the [`dialog`](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role) role's states, properties, and keyboard focus requirements are applicable to the `alertdialog` role as well.
Because of its urgent nature, interrupting the user's workflow, alert dialogs must always be [modal](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal).
The alert dialog must have at least one focusable control — such as Confirm, Close, and Cancel — and focus must be moved to that control when the alert dialog appears. Alertdialogs can have additional interactive controls such as text fields and checkboxes.
The `alertdialog` role is not to be used as a replacement for other dialogs, including no-confirmation-required `alert` dialogs ([`Window.alert()`](/en-US/docs/Web/API/Window/alert)) and prompts ([`Window.prompt()`](/en-US/docs/Web/API/Window/prompt)).
Adding `role="alertdialog"` alone is not sufficient to make an alert dialog accessible. The following also need to be done:
- The alert dialog must be properly labeled
- Keyboard focus must be managed correctly
The `alertdialog` must have an accessible name, defined with [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) or [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label). The alert dialog text must have an {{glossary("accessible description")}} using [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby).
## Examples
### Example 1: A basic alert dialog
```html
<div
role="alertdialog"
aria-labelledby="dialog1Title"
aria-describedby="dialog1Desc">
<div role="document" tabindex="0">
<h2 id="dialog1Title">Your login session is about to expire</h2>
<p id="dialog1Desc">To extend your session, click the OK button</p>
<button>OK</button>
</div>
</div>
```
The code snippet above shows how to mark up an alert dialog that only provides a message and an OK button.
### Example 2: Confirmation dialog with two options
```html
<div
id="alert_dialog"
role="alertdialog"
aria-modal="true"
aria-labelledby="dialog_label"
aria-describedby="dialog_desc">
<h2 id="dialog_label">Confirmation</h2>
<div id="dialog_desc">
<p>Are you sure you want to delete this image?</p>
<p>This change can't be undone.</p>
</div>
<ul>
<li>
<button type="button" onclick="closeThis()">No</button>
</li>
<li>
<button
type="button"
aria-controls="form"
id="delete_file_confirm"
onclick="deleteFile()">
Yes
</button>
</li>
</ul>
</div>
```
### Associated WAI-ARIA roles, states, and properties
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : Use this attribute to label the alertdialog. The `aria-labelledby` attribute is generally the id of the element used to title the alertdialog.
- [`aria-describedby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby)
- : Use this attribute to encompass the description of the contents of the alert dialog. The value of the `aria-describedby` attribute is generally the ID of the element containing the alert dialog's messaging, usually coming right after the title.
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement("dialog")}} element
- [The `dialog` role](/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role)
- [The `alert` role](/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)
- [`aria-modal` attribute](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal)
- [`Window.alert()`](/en-US/docs/Web/API/Window/alert)
- [`Window.prompt()`](/en-US/docs/Web/API/Window/prompt)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/feed_role/index.md | ---
title: "ARIA: feed role"
slug: Web/Accessibility/ARIA/Roles/feed_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#feed
---
A `feed` is a dynamic scrollable `list` of `articles` in which articles are added to or removed from either end of the list as the user scrolls. A `feed` enables screen readers to use the browse mode reading cursor to both read and scroll through a stream of rich content that may continue scrolling infinitely by loading more content as the user reads.
```html
<section role="feed" aria-busy="false">
…
<article aria-posinset="427" aria-setsize="-1">…</article>
<article aria-posinset="428" aria-setsize="-1">…</article>
<article aria-posinset="429" aria-setsize="-1">…</article>
…
</section>
```
## Description
A `feed` is a type of [`list`](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role), the containing role for scrollable [`articles`](/en-US/docs/Web/Accessibility/ARIA/Roles/article_role) where scrolling may cause articles to be added to the top or end of the list. The role enables assistive technology to use the browse mode reading cursor to both read and scroll through a stream of rich content that may continue scrolling infinitely by loading more content as the user reads. Examples include an RSS feed, news feeds, social media feeds like Facebook, Instagram or Mastodon, or even a list of related products on an e-commerce page. These streams can be limited or infinite, loading more content as the user scrolls. Implementing the `feed` pattern allows a screen reader to reliably read and trigger the loading of feed content while in reading mode.
Unlike the document structure elements that represent static HTML elements, the `feed` role requires specific interactions and implementation of keyboard navigation. The `feed` is a container element whose children are {{HTMLElement('article')}}s or have role `article`. Each article within a feed should be focusable, with tabindex of 0 or -1. An article should be scrolled into view when it, or a descendant element, receives focus. If the addition of articles occupies the main browser thread, make sure to set `aria-busy="true"` on the feed itself, and make sure to set it back to `false` when processing ends, or the user may not see the updates.
If the number of articles is known, set [`aria-setsize`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize) on the articles themselves. However, if the total number is extremely large, indefinite, or changes often, set `aria-setsize="-1"` to indicate that the size of the feed is not known.
Another feature of the feed pattern is skim reading: Articles within a feed can contain both an accessible name with the [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) and a description with an `aria-describedby,` suggesting to screen readers which elements to speak after the label when navigating by article. By identifying the elements inside an article that provide the title and the primary content, assistive technologies can provide functions that enable users to jump from article to article and efficiently discern which articles they want to read.
The feed pattern enables reliable assistive technology reading mode interaction by establishing the following interoperability agreement between the web page and assistive technologies:
In the context of a feed, the web page code is responsible for:
- Appropriate visual scrolling of the content based on which article contains DOM focus.
- Loading or removing feed articles based on which article contains DOM focus.
### Keyboard interactions
Supporting the following, or a similar, interface is recommended when focus is inside the feed:
- <kbd>Page Down</kbd>: Move focus to next article.
- <kbd>Page Up</kbd>: Move focus to previous article.
- <kbd>Control + End</kbd>: Move focus to the first focusable element after the feed.
- <kbd>Control + Home</kbd>: Move focus to the first focusable element before the feed.
If a feed is nested within a feed, such as a comments feed within a feed of blog posts, the convention is to tab into the nested feed with the <kbd>Tab</kbd> key and to provide another key, such as <kbd>Alt + Page Down</kbd>, to navigate from an 'outer' article to the first item in that article's nested feed. Navigate between the nested feed and main feed with <kbd>Control + End</kbd>, moving focus from the inner feed to the next article in the outer feed.
### <abbr title="Accessible Rich Internet Applications">WAI-ARIA</abbr> roles, states, and properties
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- : If the feed has no visible title, the `feed` element has a label specified with `aria-label`. If it does, see `aria-labelledby`.
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : If the feed has a visible title, the `feed` element has `aria-labelledby` referring to the element containing the title. If not, add an `aria-label`.
- [`aria-busy`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy)
- : When busy, such as when articles are being added or removed from the `feed`, set `aria-busy="true"` during the update operation. Make sure it's reset to `false` when the operation is complete or the changes may not become visible.
- article
- : Each section of content in a feed should be contained in an `<article>` or element with role [`article`](/en-US/docs/Web/Accessibility/ARIA/Roles/article_role). Each `article` should have an `aria-labelledby` referring to the article title or other child that can serve as a distinguishing label. Each article should preferably have `aria-describedby` referring to one or more elements inside the article that serve as the primary content of the article. Each `article` element has [`aria-posinset`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-posinset) set to a value that represents its position in the feed and an [`aria-setsize`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-setsize) set to a value that represents either the total number of articles that have been loaded or the total number in the feed, depending on which value is more helpful to users. If the total number in the feed is not known, set `aria-setsize="-1"`.
### Required JavaScript features
None, except as required by any attributes. For example, setting [`aria-busy`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy) to `true` during the update operation if needed, and then to `false` upon completion.
Note: It is the author's responsibility to apply the "above" keyboard behavior.
## Examples
[Example Implementation of Feed Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/feed/examples/feed/)
## Best practices
To ensure good user experience, avoid inserting or removing articles in the middle of a `feed`, load new articles before the user has reached the end of the feed, and provide keyboard commands for moving focus among articles so that keyboard users can navigate through your feed. See [Keyboard interactions](#keyboard_interactions).
## Specifications
{{Specifications}}
## See also
- The HTML {{HTMLElement('article')}} element
- The {{HTMLElement('ul')}} unordered list element
- [ARIA: `article` role](/en-US/docs/Web/Accessibility/ARIA/Roles/article_role)
- [ARIA: `list` role](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/listbox_role/index.md | ---
title: "ARIA: listbox role"
slug: Web/Accessibility/ARIA/Roles/listbox_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#listbox
- https://www.w3.org/WAI/ARIA/apg/patterns/listbox/examples/listbox-scrollable/
---
The `listbox` role is used for lists from which a user may select one or more items which are static and, unlike HTML {{HTMLElement('select')}} elements, may contain images.
## Description
The `listbox` role is used to identify an element that creates a list from which a user may select one or more static items, similar to the HTML {{HTMLElement('select')}} element. Unlike {{HTMLElement('select')}}, a listbox can contain images. Each child of a listbox should have a role of [option](https://www.w3.org/TR/2010/WD-wai-aria-20100916/roles#option).
It is highly recommended using the HTML select element, or a group of radio buttons if only one item can be selected, or a group of checkboxes if multiple items can be selected, because there is a lot of keyboard interactivity to manage focus for all the descendants, and native HTML elements provide this functionality for you for free.
Elements with the role `listbox` have an implicit [`aria-orientation`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-orientation) value of `vertical`.
When a list is tabbed to, the first item in the list will be selected if nothing else already is. Up/down arrows navigate the list, and pressing Shift + Up/Down arrows will move and extend the selection. Typing one or more letters will navigate the list items (same letter goes to each item starting with that, different letters go to the first item starting with that entire string). If the current item has an associated context menu, Shift+F10 will launch that menu. If list items are checkable, Space can be used to toggle [checkboxes](/en-US/docs/Web/Accessibility/ARIA/Roles/checkbox_role). For selectable list items, Space toggles their selection, Shift+Space can be used to select contiguous items, Ctrl+Arrow moves without selecting, and Ctrl+Space can be used to select non-contiguous items. It is recommended that a checkbox, link or other method be used to select all items, and Ctrl+A could be used as a shortcut key for this.
When the listbox role is added to an element, or such an element becomes visible, screen readers announce the label and role of the listbox when it gets focus. If an option or item is focused within the list, it gets announced next, followed by an indication of the item's position with the list if the screen reader supports this. As focus moves within the list, the screen reader announces the relevant items.
### Associated ARIA roles, states, and properties
#### Associated Roles
- [`option`](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role) role
- : One or more nested options are required. All selected options have [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) set to `true`. All options that are not selected have [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) set to `false`. If an option is not selectable, omit the [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected).
- [`list`](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role) role
- : A section containing `listitem` elements
#### States and Properties
- [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant)
- : Holds the `id` string of the currently active element within the listbox. If that's an option element, then that would be the `id` of the most recently interacted with option, regardless of whether that option has an [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) value of `true` or not. Takes the value of only one `id`, even in a multiselectable listbox. If the `id` does not refer to a DOM descendant of the listbox, then that `id` must be included among the IDs in the [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns) attribute.
- [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns)
- : This is a space-separated list of element IDs which are not DOM child elements of the listbox. IDs listed here cannot also be listed in [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns) attributes of any other elements.
- [`aria-multiselectable`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-multiselectable)
- : Include and set to `true` if the user can select more than one option. If set to `true`, _every_ selectable option should have an [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) attribute included and set to `true` or `false`. Options which are _not_ selectable _should not_ have the [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) attribute. If `false` or omitted, only the currently selected option, if any option is selected, needs the [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) attribute, and it must be set to `true`.
- [`aria-required`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-required)
- : A Boolean attribute which indicates that an option with a non-empty string value must be selected.
- [`aria-readonly`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly)
- : The user cannot change which options are selected or unselected, but the listbox is otherwise operable.
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label)
- : A human-readable string value which identifies the listbox. If there's a visible label, then [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) should be used instead to refer to that label.
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby)
- : Identifies the visible element or elements in a space-separated list of element IDs which identify the listbox. If there's no visible label, then [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) should be used instead to include a label. (Note: "labelled", with two L's, is the correct spelling based on the accessibility API conventions.)
- [`aria-roledescription`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-roledescription)
- : A human-readable string value which more clearly identifies the role of the listbox. Screen readers will often read this value to the user after reading the label (if there is one), in place of saying "listbox".
### Keyboard interactions
- When a single-select listbox receives focus:
- If none of the options are selected before the listbox receives focus, the first option receives focus. Optionally, the first option may be automatically selected.
- If an option is selected before the listbox receives focus, focus is set on the selected option.
- When a multi-select listbox receives focus:
- If none of the options are selected before the listbox receives focus, focus is set on the first option and there is no automatic change in the selection state.
- If one or more options are selected before the listbox receives focus, focus is set on the first option in the list that is selected.
- <kbd>Down Arrow</kbd>
: Moves focus to the next option. Optionally, in a single-select listbox, selection may also move with focus.
- <kbd>Up Arrow</kbd>
: Moves focus to the previous option. Optionally, in a single-select listbox, selection may also move with focus.
- <kbd>Home</kbd>
(Optional): Moves focus to first option. Optionally, in a single-select listbox, selection may also move with focus. Supporting this key is strongly recommended for lists with more than five options.
- <kbd>End</kbd>
(Optional): Moves focus to last option. Optionally, in a single-select listbox, selection may also move with focus. Supporting this key is strongly recommended for lists with more than five options.
- Type-ahead is recommended for all listboxes, especially those with more than seven options:
- Type a character: focus moves to the next item with a name that starts with the typed character.
- Type multiple characters in rapid succession: focus moves to the next item with a name that starts with the string of characters typed.
- **Multiple Selection**: Authors may implement either of two interaction models to support multiple selection: a recommended model that does not require the user to hold a modifier key, such as
<kbd>Shift</kbd>
or
<kbd>Control</kbd>
, while navigating the list or an alternative model that does require modifier keys to be held while navigating in order to avoid losing selection states.
- Recommended selection model — holding modifier keys is not necessary:
- <kbd>Space</kbd>
: changes the selection state of the focused option .
- <kbd>Shift + Down Arrow</kbd>
(Optional): Moves focus to and toggles the selected state of the next option.
- <kbd>Shift + Up Arrow</kbd>
(Optional): Moves focus to and toggles the selected state of the previous option.
- <kbd>Shift + Space</kbd>
(Optional): Selects contiguous items from the most recently selected item to the focused item.
- <kbd>Control + Shift + Home</kbd>
(Optional): Selects the focused option and all options up to the first option. Optionally, moves focus to the first option.
- <kbd>Control + Shift + End</kbd>
(Optional): Selects the focused option and all options down to the last option. Optionally, moves focus to the last option.
- <kbd>Control + A</kbd>
(Optional): Selects all options in the list. Optionally, if all options are selected, it may also unselect all options.
### Required JavaScript features
#### selecting an option in a single select listbox
When the user selects an option, the following must occur:
1. Deselect the previously selected option, setting the [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) to `false`, or removing the attribute altogether, changing the appearance of the newly unselected option to appear not selected.
2. Select the newly selected option, setting `aria-selected="true"` on the option and changing the appearance of the newly selected option to appear selected.
3. Update the [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant) value on the listbox to the id of the newly selected option
4. Visually handle the blur, focus, and selected states of the option
#### Toggling the state of an option in a multi select listbox
When the user clicks on an option, hits <kbd>Space</kbd> when focused on an option, or otherwise toggles the state of an option, the following must occur:
1. Toggle the [`aria-selected`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) state of the currently focused option, changing the state of the `aria-selected` to true if it was false or false if it was true.
2. Change the appearance of the option to reflect its selected state
3. Update the [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant) value on the listbox to the ID of the option the user just interacted with, even if they toggled the option to be unselected.
> **Note:** The first rule of ARIA use is you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and **adding** an ARIA role, state or property to make it accessible, then do so. The {{HTMLElement('select')}} element with descendant {{HTMLElement('option')}} elements handles all the needed interactions natively.
## Examples
### Example 1: A single select listbox that uses `aria-activedescendant`
The snippet below, using [`aria-activedescendant`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-activedescendant), shows how the listbox role is added directly into the HTML source code.
```html
<p id="listbox1label" role="label">Select a color:</p>
<div
role="listbox"
tabindex="0"
id="listbox1"
aria-labelledby="listbox1label"
onclick="return listItemClick(event);"
onkeydown="return listItemKeyEvent(event);"
onkeypress="return listItemKeyEvent(event);"
aria-activedescendant="listbox1-1">
<div role="option" id="listbox1-1" class="selected" aria-selected="true">
Green
</div>
<div role="option" id="listbox1-2">Orange</div>
<div role="option" id="listbox1-3">Red</div>
<div role="option" id="listbox1-4">Blue</div>
<div role="option" id="listbox1-5">Violet</div>
<div role="option" id="listbox1-6">Periwinkle</div>
</div>
```
This could have more easily been handled with the native HTML {{HTMLElement('select')}} and {{HTMLElement('label')}} elements.
```html
<label for="listbox1">Select a color:</label>
<select id="listbox1">
<option selected>Green</option>
<option>Orange</option>
<option>Red</option>
<option>Blue</option>
<option>Violet</option>
<option>Periwinkle</option>
</select>
```
### More examples
- [Scrollable Listbox Example](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/examples/listbox-scrollable/): Single-select listbox that scrolls to reveal more options, similar to HTML {{HTMLElement('select')}} with `size` attribute greater than one.
- [Listbox Example with Grouped Options](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/examples/listbox-grouped/): Single-select listbox with grouped options, similar to HTML {{HTMLElement('select')}} with the attribute `size` set to greater than `"1"` and options grouped with `optgroup` elements.
- [Example Listboxes with Rearrangeable Options](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/examples/listbox-rearrangeable/): Examples of both single-select and multi-select listboxes with accompanying toolbars where options can be added, moved, and removed.
## Best practices
- To be keyboard-accessible, authors should [manage focus](https://www.w3.org/TR/wai-aria-1.1/#managingfocus) of all descendants of this role.
- It is recommended that authors use different styling for the selection when the list is not focused, e.g. a non-active selection is often shown with a lighter background color.
- If the listbox is not part of another widget, it should have the [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) property set.
- If one or more entries are not DOM children of listbox, additional `aria-*` properties will need to be set (see [ARIA Best Practices](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/)).
- If there is a valid reason to [expand](https://www.w3.org/TR/wai-aria-1.1/#aria-expanded) the listbox, the [`combobox`](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role) role may be more appropriate.
## Specifications
{{Specifications}}
## See also
- HTML {{HTMLElement('select')}} element
- HTML {{HTMLElement('label')}} element
- HTML {{HTMLElement('option')}} element
- [ARIA: `combobox` role](/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role)
- [ARIA: `option` role](/en-US/docs/Web/Accessibility/ARIA/Roles/option_role)
- [ARIA: `list` role](/en-US/docs/Web/Accessibility/ARIA/Roles/list_role)
- [ARIA: `listitem` role](/en-US/docs/Web/Accessibility/ARIA/Roles/listitem_role)
- [ARIA Best Practices – Listbox](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/)
- [ARIA Role Model – Listbox](https://www.w3.org/TR/wai-aria-1.1/#listbox)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/widget_role/index.md | ---
title: "ARIA: widget role"
slug: Web/Accessibility/ARIA/Roles/widget_role
page-type: aria-role
spec-urls: https://w3c.github.io/aria/#widget
---
The **`widget`** role, an [abstract role](/en-US/docs/Web/Accessibility/ARIA/Roles#6._abstract_roles), is an interactive component of a graphical user interface (GUI).
> **Note:** The `widget` role is an abstract role used for the ontology. It is included here for completeness of documentation. It should not be used by web authors.
## Description
The abstract `widget` role is a superclass role for some interactive GUI elements and grouping roles. `role="widget"` should not be confused with widgets roles, such as `option`, `menuitem`, and `searchbox`.
The `widget` role is a superclass role several abstract interactive GUI roles, including [`command`](/en-US/docs/Web/Accessibility/ARIA/Roles/command_role), [`composite`](/en-US/docs/Web/Accessibility/ARIA/Roles/composite_role), [`input`](/en-US/docs/Web/Accessibility/ARIA/Roles/input_role), [`range`](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role), and [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role) (if focusable), which should not be used by web authors.
The abstract `widget` role is also a superclass role for some grouping roles which can be used by web authors, including [`gridcell`](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role), [`row`](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role), [`separator`](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role) (when not focusable), and [`tab`](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role), which can and should be used when appropriate. When the user navigates to one of these non-abstract roles of widget, keyboard events can switch to an application browsing mode, and pass keyboard events through to the browser.
## Best Practices
Do not use.
## Specifications
{{Specifications}}
## See also
- [ARIA: `roletype` role](/en-US/docs/Web/Accessibility/ARIA/Roles/roletype_role)
- [ARIA: `command` role](/en-US/docs/Web/Accessibility/ARIA/Roles/command_role)
- [ARIA: `composite` role](/en-US/docs/Web/Accessibility/ARIA/Roles/composite_role)
- [ARIA: `gridcell` role](/en-US/docs/Web/Accessibility/ARIA/Roles/gridcell_role)
- [ARIA: `input` role](/en-US/docs/Web/Accessibility/ARIA/Roles/input_role)
- [ARIA: `range` role](/en-US/docs/Web/Accessibility/ARIA/Roles/range_role)
- [ARIA: `row` role](/en-US/docs/Web/Accessibility/ARIA/Roles/row_role)
- [ARIA: `separator` role](/en-US/docs/Web/Accessibility/ARIA/Roles/separator_role)
- [ARIA: `tab` role](/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
data/mdn-content/files/en-us/web/accessibility/aria/roles | data/mdn-content/files/en-us/web/accessibility/aria/roles/main_role/index.md | ---
title: "ARIA: main role"
slug: Web/Accessibility/ARIA/Roles/main_role
page-type: aria-role
spec-urls:
- https://w3c.github.io/aria/#main
- https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/main.html
---
The `main` landmark role is used to indicate the primary content of a document. The main content area consists of content that is directly related to or expands upon the central topic of a document, or the main function of an application.
```html
<div id="main" role="main">
<h1>Avocados</h1>
<!-- main section content -->
</div>
```
This is the main section of a document that discusses avocados. Subsections of this document could discuss their history, the different types, regions where they grow, etc.
## Description
The `main` role is a navigational [landmark](/en-US/docs/Web/Accessibility/ARIA/Roles#3._landmark_roles) role identifying the main content of a document. Landmarks can be used by assistive technology such as screen readers to quickly identify and navigate to large sections of the document.
By classifying and labeling sections of a page, structural information conveyed visually through layout can be represented programmatically. Screen readers use landmark roles to provide keyboard navigation to important sections of a page. For those navigating via landmark roles, the main role is an alternative for "skip to main content" links.
There should only be one `main` landmark role per document.
The {{HTMLElement('main')}} element has a role of `main`. Developers should use semantic HTML — in this case {{HTMLElement('main')}} — over using ARIA.
### Associated ARIA roles, states, and properties
- [`aria-owns`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns)
- : The `aria-owns` attribute establishes relationships in the accessibility layer that aren't present in the DOM. Documents and applications can be nested in the DOM, which may lead to having more than one main element as DOM descendants. If this is the case, include `aria-owns` to identify the relationship of the main to its document or application ancestor.
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) or `aria-labelledby`
- : Identify the accessible name with [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) if a visible header is present. Otherwise, including an [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) can be helpful for orienting assistive technology users, especially in single-page applications where main content changes happen without generating a page load event.
## Example
```html
<body>
<!-- primary navigation -->
<div role="main">
<h1>The First Indochina War</h1>
<!-- article content -->
</div>
<!-- sidebar and footer -->
</body>
```
## Accessibility concerns
### Use only one `main` role per document
The `main` [landmark role](/en-US/docs/Web/Accessibility/ARIA/Roles#3._landmark_roles) should only be used once per document.
If a document contains two `main` roles, say updating page content when triggered by JavaScript, the inactive `main` role's presence should be removed from assistive technology via techniques such as toggling the [`hidden` attribute](/en-US/docs/Web/HTML/Global_attributes/hidden).
```html
<main>
<h1>Active `main` element</h1>
<!-- content -->
</main>
<main hidden>
<h1>Hidden `main` element</h1>
<!-- content -->
</main>
```
It is also helpful to include an accessible name to help orient assistive technology users, especially in single-page applications where main content changes happen without generating a page load event. This can be added with `aria-labelledby` if there is an appropriate name in the content, or `aria-label` if not.
## Best practices
### Prefer HTML
Using the {{HTMLElement('main')}} element will automatically communicate a section has a role of `main`. If at all possible, prefer using it instead.
### Skip navigation
Skip navigation, also known as "skipnav", is a technique that allows an assistive technology user to quickly bypass large sections of repeated content (main navigation, info banners, etc.). This allows the user to access the main content of the page faster.
Adding an [`id` attribute](/en-US/docs/Web/HTML/Global_attributes/id) to the element with a declaration of `role="main"` allows it to be a target of a skip navigation link users.
```html
<body>
<a href="#main-content">Skip to main content</a>
<!-- navigation and header content -->
<div id="main-content" role="main">
<!-- main page content -->
</div>
</body>
```
Which is the equivalent of:
```html
<body>
<a href="#main-content">Skip to main content</a>
<!-- navigation and header content -->
<main id="main-content">
<!-- main page content -->
</main>
</body>
```
- [WebAIM: "Skip Navigation" Links](https://webaim.org/techniques/skipnav/)
## Specifications
{{Specifications}}
## See also
- The {{HTMLElement('main')}} element
- [Using HTML sections and outlines](/en-US/docs/Web/HTML/Element/Heading_Elements)
- [Using WAI-ARIA Landmarks – 2013 | The Paciello Group](https://www.tpgi.com/using-wai-aria-landmarks-2013/)
- [Accessible Landmarks | scottohara.me](https://www.scottohara.me/blog/2018/03/03/landmarks.html)
- [The main element | HTML5 Doctor](https://html5doctor.com/the-main-element/)
<section id="Quick_links">
1. [**WAI-ARIA roles**](/en-US/docs/Web/Accessibility/ARIA/Roles)
{{ListSubpagesForSidebar("/en-US/docs/Web/Accessibility/ARIA/Roles", 1)}}
</section>
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.