Accessible Name and Description Computation 1.2 (original) (raw)
Abstract
This document describes how user agents determine the names anddescriptions of accessible objects from web content languages. This information is in turn exposed throughaccessibility APIs so that assistive technologies can identify these objects and present their names or descriptions to users. Documenting the algorithm through which names and descriptions are to be determined promotes interoperable exposure of these properties among different accessibility APIs and helps to ensure that this information appears in a manner consistent with author intent.
The accessible name and description computation specification defines support that applies across multiple content technologies. This includes accessible name and description provided by general-purposeWAI-ARIA [WAI-ARIA] roles, states, and properties as well as features specific to individual content languages.
This document updates and will eventually supersede the accessible name and description guidance in theAccessible Name and Description Computation 1.1 [ACCNAME-1.1] W3C Recommendation. It is part of theWAI-ARIA suite described in theWAI-ARIA Overview.
Status of This Document
This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in theW3C standards and drafts index at https://www.w3.org/TR/.
This document was published by the Accessible Rich Internet Applications Working Group as an Editor's Draft.
Publication as an Editor's Draft does not imply endorsement by W3C and its Members.
This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under theW3C Patent Policy.W3C maintains apublic list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes containsEssential Claim(s) must disclose the information in accordance withsection 6 of the W3C Patent Policy.
This document is governed by the03 November 2023 W3C Process Document.
Table of Contents
- Abstract
- Status of This Document
- 1. Introduction
- 2. Important Terms
- 3. Conformance
- 4. Name and Description
- 5. Accessible Name and Description Mapping
- 6. Appendices
- A. References
This section is non-normative.
User agents acquire information from the DOM [DOM] and create a parallel structure called theaccessibility tree, made up of accessible objects. An accessible object provides information about its role,states, and properties. An example is an accessible object whose role is menuitem
, is currently in an enabled
state, with ahaspopup
property, indicating that it leads to a sub-menu.
The two properties of accessible objects described in this document are its accessible name and accessible description. The name is a short label that provides information about the purpose of the object. An example of an accessible name for a menu item is New
, signifying that the menu item provides for the creation of new documents, windows, and so on.
The description is a short explanation that further clarifies the nature of the accessible object. It is not always necessary to provide a description if the name is sufficient, but it can help a user better understand the use of the object.
Accessibility APIs currently support flat, unstructured strings for accessible names and descriptions. The result of the name/description computation is thus a flat string.
The terms "accessible name" and "accessible description" are used to emphasize that they are properties of accessible objects as exposed byAccessibility APIs. However, they are frequently referred to hereafter as simply "name" and "description".
This section is non-normative.
While some terms are defined in place, the following definitions are used throughout this document.
Assistive Technologies
Hardware and/or software that:
- relies on services provided by a user agent to retrieve and render Web content
- works with a user agent or web content itself through the use of APIs, and
- provides services beyond those offered by the user agent to facilitate user interaction with web content by people with disabilities
This definition may differ from that used in other documents.
Examples of assistive technologies that are important in the context of this document include the following:
- screen magnifiers, which are used to enlarge and improve the visual readability of rendered text and images;
- screen readers, which are most-often used to convey information through synthesized speech or a refreshable Braille display;
- text-to-speech software, which is used to convert text into synthetic speech;
- speech recognition software, which is used to allow spoken control and dictation;
- alternate input technologies (including head pointers, on-screen keyboards, single switches, and sip/puff devices), which are used to simulate the keyboard;
- alternate pointing devices, which are used to simulate mouse pointing and clicking.
Accessible Description
An accessible description provides additional information, related to an interface element, that complements the accessible name. The accessible description might or might not be visually perceivable.
Accessible Name
The accessible name is the name of a user interface element. Each platform accessibility API provides the accessible name property. The value of the accessible name may be derived from a visible (e.g., the visible text on a button) or invisible (e.g., the text alternative that describes an icon) property of the user interface element. See related accessible description.
A simple use for the accessible name property may be illustrated by an "OK" button. The text "OK" is the accessible name. When the button receives focus, assistive technologies may concatenate the platform's role description with the accessible name. For example, a screen reader may speak "push-button OK" or "OK button". The order of concatenation and specifics of the role description (e.g., "button", "push-button", "clickable button") are determined by platformaccessibility APIs or assistive technologies.
Tooltip attribute
Any host language attribute that would result in a user agent generating a tooltip such as in response to a mouse hover in desktop user agents.
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, and MUST NOT in this document are to be interpreted as described inBCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
RFC-2119 keywords are formatted in uppercase and in bold type font. When the keywords shown above are used, but do not share this format, they do not convey formal information in the RFC 2119 sense, and are merely explanatory, i.e., informative. As much as possible, such usages are avoided in this specification.
The indication whether a section is normative or non-normative (informative) applies to the entire section including sub-sections.
Informative sections provide information useful to understanding the specification. Such sections may contain examples of recommended practice, but it is not required to follow such recommendations in order to conform to this specification.
The starting point of the name and description computation is a DOM element. The output is a flat, unstructured string that can be as simple as a single word, or a string of space-separated tokens. Examples include Save
and Reload from disk
.
An important factor is the element's role, that determines which content contributes to the name string. Roles have a nameFrom
RDF property, with three possible values:
author
name is generated from values provided by the author in explicit markup features such as thearia-label
and aria-labelledby
attribute, or a host language labeling mechanism, such as the alt
or title
attribute inHTML, or the desc
element in SVG.
contents
name is generated from the text nodes associated with the element. Although this may be allowed in addition to "author" in some roles, "content" is used only if higher priority "author" features are not provided. Priority is defined by the text equivalent computation algorithm.
prohibited
the element has no name. Authors _MUST NOT use the aria-label oraria-labelledby attributes to name the element.
The Accessible Rich Internet Applications (WAI-ARIA) 1.2 [WAI-ARIA] specification provides lists ofroles that support name from author, roles that support name from content androles that cannot be named.
User agents MUST compute an accessible name using the rules outlined below in the section titledText Equivalent Computation.
The following table provides the order of precedence for markup that can be applied to compute an accessible description. User agents MUST use the first applicable entry from the table where the listed conditions are met, as described in the last column. The user agent MUST NOT use any markup other that the first relevant markup found, even if that markup results in an empty description:
Precedence | Attribute | Applicable conditions | How used to compute description |
---|---|---|---|
1 | aria-describedby attribute | Use on any element | Name computation on all nodes referenced by aria-describedby on the element, concatenated, and separated by a space character |
2 | aria-description attribute | Use on any element | As a flat string |
3 | host language features which participate in the description calculation | Unique host language features MAY participate in the description computation for an element, only if they were not already used for the accessible name of the applicable element. SeeHTML AAM: Accessible Description Computation for the HTML elements which meet this condition. | Either a text equivalent computation of the host language element, or the string value of the host language attribute. |
4 | host language tooltip attribute or equivalent feature (e.g., HTML title attribute) | Any element Only use if not already used for the accessible name of this node | As a flat string |
The text equivalent computation is used by both the accessible name and accessible description. There are different rules provided for several different types of elements, nodes, and combinations of markup. Text alternatives are built up, when appropriate, from all the relevant content contained within anelement. This is accomplished via steps 2B and 2F, which are recursive, using the full set of rules to retrieve text from its own children or nodes it references.
The purpose of the computation is to create a perceivable label or description for alternative presentations, in the form of a flat string of space separated textual tokens.
Root node
The DOM node or element for which the text alternative is sought.
Current node
The DOM node currently traversed to compute the root node
's text equivalent. Initially, the current node
is the root node
, but at later stages is either some descendant of the root node
, or another referenced node.
Rendered child nodes
The nodes that are rendered as child nodes of a given node when taking shadow roots and slots into consideration.
Flat string
A string of characters where all carriage returns, newlines, tabs, and form-feeds are replaced with a single space, and multiple spaces are reduced to a single space. The string contains only character data; it does not contain any markup.
Total accumulated text
The text equivalent computed up to, but not including the current node
.
Accumulated text
Text accumulated at a step or sequence of steps described below. It is temporary storage for those steps.
Result
The text equivalent computed at one of the steps described below.
Append the result, without a space, to X
- If X is empty, copy the
result
to X. - If X is non-empty, copy the
result
to the end of X.
Append the result, with a space, to X
- If X is empty, copy the
result
to X. - If X is non-empty, add a space to the end of X and then copy the
result
to X after the space.
Prepend result, without a space, to X
- If X is empty, copy the
result
to X. - If X is non-empty, copy the
result
to the start of X.
Prepend the result, with a space, to X
- If X is empty, copy the
result
to X. - If X is non-empty, copy the
result
to the start of X, and add a space after the copy.
The text alternative for a given element is computed as follows:
- Initialization: Set the
root node
to the given element, thecurrent node
to theroot node
, and thetotal accumulated text
to the empty string (""). If theroot node
's role prohibits naming, return the empty string (""). - Computation: Compute the text alternative for the
current node
:- Hidden Not Referenced: If the
current node
ishidden and is:- Not part of an
aria-labelledby
oraria-describedby
traversal, where the node directly referenced by that relation was hidden. - Nor part of a native host language text alternative element (e.g.
label
in HTML) orattribute traversal, where the root of that traversal was hidden.
Return the empty string.
Note
It's important to clarify the broad definition of hidden for the purposes of accessible name calculation: - Nodes with CSS properties
display:none
,visibility:hidden
,visibility:collapse
orcontent-visibility:hidden
: They are considered hidden, as they match the guidelines "not perceivable" and "explicitly hidden". - Nodes with CSS properties
opacity:0
orfilter:opacity(0%)
, or similar SVG mechanisms: They are not considered hidden. Text hidden with these methods can still be selected or copied, and user agents still expose it in their accessibility trees. - Nodes with the
aria-hidden="true"
property: it is considered hidden, matching the "explicitly hidden" guideline. - Nodes hidden off screen or behind another object: they are not considered hidden. They are exposed in the accessibility tree and they can even name on-screen objects.
Note
By default, assistive technologies do not relay hidden information, but an author can explicitly override that and include hidden text as part of theaccessible name or accessible description by usingaria-labelledby
oraria-describedby
.
- Not part of an
- LabelledBy: Otherwise, if the
current node
has anaria-labelledby
attribute that contains at least one valid IDREF, and thecurrent node
is not already part of an ongoingaria-labelledby
oraria-describedby
traversal, process its IDREFs in the order they occur:- Set the
accumulated text
to the empty string. - For each IDREF:
1. Set thecurrent node
to the node referenced by the IDREF.
2. LabelledBy Recursion: Compute the text alternative of thecurrent node
beginning with the overall Computation step. Set theresult
to that text alternative.
3. Append a space character and theresult
to theaccumulated text
. - Return the
accumulated text
if it is not the empty string ("").
The result of LabelledBy Recursion in combination with Hidden Not Referenced means thatuser agents MUST include all nodes in the subtree as part of the accessible name or accessible description, when the node referenced byaria-labelledby
oraria-describedby
is hidden.
- Set the
- Embedded Control: Otherwise, if the
current node
is a control embedded within the label (e.g. any element directly referenced byaria-labelledby
) for another widget, where the user can adjust the embedded control's value, then return the embedded control as part of the text alternative in the following manner:- Textbox: If the embedded control has role textbox, return its value.
- Combobox/Listbox: If the embedded control has role combobox or listbox, return the text alternative of the chosen option.
- Range: If the embedded control has role range (e.g., a spinbutton orslider):
1. If thearia-valuetext
property is present, return its value,
2. Otherwise, if thearia-valuenow
property is present, return its value,
3. Otherwise, use the value as specified by a host language attribute.
- AriaLabel: Otherwise, if the
current node
is not a slot element and has anaria-label
attribute whose value is not undefined, not the empty string, nor, when trimmed of whitespace, is not the empty string:- If traversal of the
current node
is due to recursion and thecurrent node
is an embedded control, ignorearia-label
and skip to rule Embedded Control. - Otherwise, return the value of
aria-label
.
- If traversal of the
- Host Language Label: Otherwise, if the
current node
's native markup provides anattribute (e.g.alt
) or element (e.g. HTMLlabel
or SVGtitle
) that defines a text alternative, return that alternative in the form of aflat string
as defined by the host language (e.g., HTML-AAM), unless thecurrent node
is exposed as presentational (role="presentation"
orrole="none"
).
Note
Important! The accessible name for native HTML elements may be calculated differently depending on host language. Make sure to reviewHTML-AAM for more information.
Note
For example, in HTML, theimg
element'salt
attribute defines a text alternative string, and thelabel
element provides text for the referenced form element. In SVG2, thedesc
andtitle
elements provide a description of their parent element. - Name From Content: Otherwise, if the
current node's
role allowsname from content, or if thecurrent node
is referenced byaria-labelledby
,aria-describedby
, or is a native host language text alternative element (e.g.label
in HTML), or is a descendant of a native host language text alternative element:- Name From Content Reset: Set the
accumulated text
to the empty string. - Name From Generated Content: Check forCSS generated textual content associated with the
current node
and include it in theaccumulated text
. TheCSS ::before and ::after pseudo elements [CSS2] can provide textual content for elements that have a content model.
1. For::before
pseudo elements, User agents MUST prepend CSS textual content, without a space, to the textual content of thecurrent node
.
2. For::after
pseudo elements, User agents MUST append CSS textual content, without a space, to the textual content of thecurrent node
. - Determine Child Nodes: Determine the
rendered child nodes
of thecurrent node
:
1. If thecurrent node
has an attached shadow root, set therendered child nodes
to be the child nodes of the shadow root.
2. Otherwise, if thecurrent node
is a slot with assigned nodes, set therendered child nodes
to be the assigned nodes of thecurrent node
.
3. Otherwise, set therendered child nodes
to be the child nodes of thecurrent node
. - Name From Each Child: For each
rendered child node
of thecurrent node
:
1. Set thecurrent node
to therendered child node
.
2. Compute the text alternative of thecurrent node
beginning with the overallComputation step. Set theresult
to that text alternative.
3. Append theresult
to theaccumulated text
. - Return the
accumulated text
if it is not the empty string ("").
Important: Each node in the subtree is consulted only once. If text has been collected from a descendant, but is referenced by another IDREF in some descendant node, then that second, or subsequent, reference is not followed. This is done to avoid infinite loops.
Note
This step can apply to the child nodes themselves, which means the computation is recursive and results in text collected from all the elements in thecurrent node
's subtree, no matter how deep it is. However, any given descendant node's text alternative can result from higher precedent markup described in steps B through D above, where "Namefrom: author" attributes provide the text alternative for the entire subtree.
Note
18 January 2024: The ARIA Working Group is considering the feasibility of joining text strings with and without spaces, depending on the CSSdisplay
value of thecurrent node
, and its adjacent nodes and pseudo-elements. The ongoing discussion is in AccName #225.
- Name From Content Reset: Set the
- Text Node: Otherwise, if the
current node
is a text node, return its textual contents. - Recursive Name From Content: Otherwise, if the
current node
is a descendant of an element whose Accessible Name or Accessible Description is being computed, and contains descendants, proceed toName From Content Reset. - Tooltip: Otherwise, if the
current node
has a Tooltip attribute, return its value.
Note
Tooltip attributes are used only if nothing else, including subtree content, has provided results. - Append a space character and the
result
of each step above to thetotal accumulated text
.
- Hidden Not Referenced: If the
- After all steps are completed, the
total accumulated text
is used as the accessible name or accessible description of theelement that initiated the computation.
Information concerning name and description accessibility API mappings, including relationships, such as labelled-by/label-for and described-by/description-for, is documented in theCore Accessibility API Mappings specification [CORE-AAM-1.2]. See the mapping table entries foraria-label, aria-labelledby, and aria-describedby.
update accname 'flash screen' example to use native clickable label element
Specify behavior when following a hidden subtree via aria-labelledby or -describedby
Update the algorithm to handle roles where naming is not supported (#53)
27-June-2019: Add statement allowing for the possibility of naming being prohibited on the root node. Note: This change in and of itself has no implementation impact, but it allows other specifications to optionally prohibit naming for a top-level element. Furthermore, even if this prohibition is made within a specification, that prohibition will not have any impact on calculating name from contents.
This section is non-normative.
The following people contributed to the development of this document.
Rahim Abdi (Apple Inc.)
NAVYA AGARWAL (Adobe)
Mario Batušić (Fabasoft)
Benjamin Beaudry (Microsoft Corporation)
Curt Bellew (Oracle Corporation)
Zoë Bijl (W3C Invited Experts)
Aleksandar Cindrikj (Netcetera)
Keith Cirkel (Microsoft Corporation)
Daniel Clark (Microsoft Corporation)
James Craig (Apple Inc.)
Chris Cuellar (Bocoup)
Hidde de Vries (Logius)
Joanmarie Diggs (Igalia)
Howard Edwards (Bocoup)
James Edwards (TPGi)
Mayuri Faldu (Navy Federal Credit Union)
Betsy Fanning (PDF Association)
Steve Faulkner (TetraLogical Services Ltd)
Jaunita Flessas (Navy Federal Credit Union)
Jane Fulton (Cisco)
Bryan Garaventa (W3C Invited Experts)
Rashmi Garimella (Google LLC)
Matt Garrish (DAISY Consortium)
Doug Geoffray (Microsoft Corporation)
Ariella Gilmore (IBM Corporation)
Glen Gordon (TPGi)
Shirisha Gubba (Google LLC)
Eloisa Guerrero (Rakuten Group, Inc.)
Jon Gunderson (University of Illinois)
Oliver Habersetzer (SAP SE)
Theo Hale (Microsoft Corporation)
Sunny Hardasani (Adobe)
Matthew Hardy (Adobe)
Peter Heumader (Fabasoft)
Sarah Higley (Microsoft Corporation)
Hans Hillen (TPGi)
Isabel Holdsworth (TPGi)
Stanley Hon (Microsoft Corporation)
Michael Jackson (Microsoft Corporation)
Duff Johnson (PDF Association)
Summer Jones (Thomson Reuters Corp.)
William Kilian (TargetStream Technologies)
Matthew King (Meta)
Zachary Kinsey (TargetStream Technologies)
Greta Krafsig (The Washington Post)
Peter Krautzberger (krautzource UG)
Nina Krauß (SAP SE)
JaEun Jemma Ku (University of Illinois)
Joe Lamyman (TetraLogical Services Ltd)
Charles LaPierre (Benetech)
Philip Lazarevic (Level Access)
Aaron Leventhal (Google LLC)
Brett Lewis (TPGi)
Andy Luhrs (Microsoft Corporation)
Sazzad Mahamud (Google LLC)
Alison Maher (Microsoft Corporation)
Mark McCarthy (University of Illinois)
Eduardo Meza Etienne (Navy Federal Credit Union)
Clay Miller (Microsoft Corporation)
Daniel Montalvo (W3C)
James Nurthen (Adobe)
Scott O'Hara (Microsoft Corporation)
Lola Odelola (W3C Invited Experts)
Adam Page (Hilton)
Michael Pennisi (Bocoup)
Roberto Perez (Microsoft Corporation)
Giacomo Petri (UsableNet)
Noah Praskins (TPGi)
Daniel Pöll (Fabasoft)
Paul Rayius (Allyant)
Adrian Roselli (W3C Invited Experts)
Marco Sabidussi (UsableNet)
Trisha Salas (Level Access)
Stefan Schnabel (SAP SE)
Harris Schneiderman (Deque Systems, Inc.)
Raymond Schwartz (Navy Federal Credit Union)
Cynthia Shelly (Google LLC)
Tzviya Siegman (W3C)
Arturo Silva (The Washington Post)
Avneesh Singh (DAISY Consortium)
Michael[tm] Smith (sideshowbarker) (W3C)
Francis Storr (Intel Corporation)
Jennifer Strickland (MITRE Corporation)
Melanie Sumner (W3C Invited Experts)
Alexander Surkov (Igalia)
James Teh (Mozilla Foundation)
Jocelyn Tran (Google LLC)
Léonie Watson (TetraLogical Services Ltd)
Jan Williams (TPGi)
Valerie Young (Igalia)
Kate Zhao (Thomson Reuters Corp.)
Xiao (Helen) Zhou (University of Illinois)
Filippo Zorzi (UsableNet)
This publication has been funded in part with U.S. Federal funds from the Department of Education, National Institute on Disability, Independent Living, and Rehabilitation Research (NIDILRR), initially under contract number ED-OSE-10-C-0067, then under contract number HHSP23301500054C, and now under HHS75P00120P00168. The content of this publication does not necessarily reflect the views or policies of the U.S. Department of Education, nor does mention of trade names, commercial products, or organizations imply endorsement by the U.S. Government.
[CORE-AAM-1.2]
Core Accessibility API Mappings 1.2. Valerie Young; Alexander Surkov. W3C. 27 March 2025. CRD. URL: https://www.w3.org/TR/core-aam-1.2/
[CSS2]
Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. Bert Bos; Tantek Çelik; Ian Hickson; Håkon Wium Lie. W3C. 7 June 2011. W3C Recommendation. URL: https://www.w3.org/TR/CSS2/
[DOM]
DOM Standard. Anne van Kesteren. WHATWG. Living Standard. URL: https://dom.spec.whatwg.org/
[html-aam-1.0]
HTML Accessibility API Mappings 1.0. Scott O'Hara. W3C. 24 March 2025. W3C Working Draft. URL: https://www.w3.org/TR/html-aam-1.0/
[infra]
Infra Standard. Anne van Kesteren; Domenic Denicola. WHATWG. Living Standard. URL: https://infra.spec.whatwg.org/
[RFC2119]
Key words for use in RFCs to Indicate Requirement Levels. S. Bradner. IETF. March 1997. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc2119
[RFC8174]
Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. B. Leiba. IETF. May 2017. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc8174
[WAI-ARIA]
Accessible Rich Internet Applications (WAI-ARIA) 1.1. Joanmarie Diggs; Shane McCarron; Michael Cooper; Richard Schwerdtfeger; James Craig. W3C. 14 December 2017. W3C Recommendation. URL: https://www.w3.org/TR/wai-aria-1.1/
[ACCNAME-1.1]
Accessible Name and Description Computation 1.1. Joanmarie Diggs; Bryan Garaventa; Michael Cooper. W3C. 18 December 2018. W3C Recommendation. URL: https://www.w3.org/TR/accname-1.1/
[wai-aria-1.2]
Accessible Rich Internet Applications (WAI-ARIA) 1.2. Joanmarie Diggs; James Nurthen; Michael Cooper; Carolyn MacLeod. W3C. 6 June 2023. W3C Recommendation. URL: https://www.w3.org/TR/wai-aria-1.2/