You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aria-practices.html
+33-9
Original file line number
Diff line number
Diff line change
@@ -3742,7 +3742,7 @@ <h3>What ARE Accessible Names and Descriptions?</h3>
3742
3742
For example, a switch button named <q>Mute Conversation</q> in the <q>off</q> state could be announced as <q>Mute Conversation switch button off</q>.
3743
3743
Because descriptions are optional strings that are usually significantly longer than names, they are presented last, sometimes after a slight delay.
3744
3744
For example, <q>Mute Conversation Switch button off, Silences alerts and notifications about activity in this conversation.</q>
3745
-
To reduce verbosity, some screen readers do not announce descriptions by default but instead inform users of their presence so that users can press a key that will announce the description.
3745
+
To reduce verbosity, some screen readers do not announce descriptions by default but instead inform users of their presence so that users can press a key that will announce the description.
3746
3746
</p>
3747
3747
</section>
3748
3748
@@ -4074,7 +4074,7 @@ <h5>Naming Tables and Figures with Captions</h5>
4074
4074
</figure></code></pre>
4075
4075
<p>
4076
4076
Like with <code>table</code> elements, if a <code>figure</code> is not named using <code>aria-label</code> or <code>aria-labelledby</code>, the content of the <code>figcaption</code> element will be used as the accessible name.
4077
-
However unlike <code>table</code> elements, if the <code>figcaption</code> element is not used for the name, it does not become an accessible description unless it is referenced by <code>aria-describedby</code>.
4077
+
However unlike <code>table</code> elements, if the <code>figcaption</code> element is not used for the name, it does not become an accessible description unless it is referenced by <code>aria-describedby</code>.
4078
4078
Nevertheless, assistive technologies will render the content of a <code>figcaption</code> regardless of whether it is used as a name, description, or neither.
4079
4079
</p>
4080
4080
<p>Using the <code>caption</code> element to name a <code>table</code> element, or a <code>figcaption</code> element to name a <code>figure</code> element, satisfies <ahref="#naming_rule_visible_text">Rule 2: Prefer Visible Text</a> and <ahref="#naming_rule_native_techniques">Rule 3: Prefer Native Techniques</a>.</p>
@@ -6281,7 +6281,11 @@ <h3>Indicating sort order with <code>aria-sort</code></h3>
6281
6281
6282
6282
<sectionid="aria-level">
6283
6283
<h2>Describing Hierarchical Structure with <code>aria-level</code></h2>
6284
-
<p>When elements have a hierarchical relationship, such as headers of sections or data in tree structures, <code>aria-level</code> is used to communicate the hierarchy between elements to assistive technologies. The value of <code>aria-level</code> is numeric, with <code>1</code> indicating the top level of the structure. The number increases for each level of nesting.</p>
6284
+
<p>
6285
+
When elements have a hierarchical relationship, such as headers of sections or data in tree structures, <code>aria-level</code> is used to communicate the hierarchy between elements to assistive technologies.
6286
+
The value of <code>aria-level</code> is numeric, with <code>1</code> indicating the top level of the structure.
6287
+
The number increases for each level of nesting.
6288
+
</p>
6285
6289
<p>Do not use <code>aria-level</code> when the DOM structure already accurately represents the elements' hierarchical relationships.</p>
6286
6290
<p>The <code>aria-level</code> attribute can be used on the following roles:</p>
6287
6291
<ul>
@@ -6293,8 +6297,14 @@ <h2>Describing Hierarchical Structure with <code>aria-level</code></h2>
6293
6297
</ul>
6294
6298
<sectionid="aria-level_heading_role">
6295
6299
<h3><code>heading</code> Role</h3>
6296
-
<p>Used together, the <code>aria-level</code> attribute and <code>heading</code> role will be treated the same by assistive technologies as the native HTML header elements: <code>h1</code>, <code>h2</code>, <code>h3</code>, <code>h4</code>, <code>h5</code> and <code>h6</code>. Do not use attribute <code>aria-level</code> and <code>heading</code> when a native HTML element can be used.</p>
6297
-
<p>This example uses the <code>heading</code> role and <code>aria-level</code> attribute to communicate levels of headings for a graph created with an SVG. The headings "Deciduous Trees" and "Evergreen Trees" are both subheadings to "Total Trees".</p>
6300
+
<p>
6301
+
Used together, the <code>aria-level</code> attribute and <code>heading</code> role will be treated the same by assistive technologies as the native HTML header elements: <code>h1</code>, <code>h2</code>, <code>h3</code>, <code>h4</code>, <code>h5</code> and <code>h6</code>.
6302
+
Do not use attribute <code>aria-level</code> and <code>heading</code> when a native HTML element can be used.
6303
+
</p>
6304
+
<p>
6305
+
This example uses the <code>heading</code> role and <code>aria-level</code> attribute to communicate levels of headings for a graph created with an SVG.
6306
+
The headings "Deciduous Trees" and "Evergreen Trees" are both subheadings to "Total Trees".
<p>In rare scenarios, legacy code cannot be converted to using HTML header elements. In these cases, the <code>aria-level</code> attribute and the <code>heading</code> role can be added to the website's header elements to communicate to assitive technologies that those elements should be treated like a native HTML section heading element.</p>
6318
+
<p>
6319
+
In rare scenarios, legacy code cannot be converted to using HTML header elements.
6320
+
In these cases, the <code>aria-level</code> attribute and the <code>heading</code> role can be added to the website's header elements to communicate to assitive technologies that those elements should be treated like a native HTML section heading element.
6321
+
</p>
6309
6322
<p>For example, "Definition of a Room" is a subsection of "Housing Specification":</p>
<p>The <code>aria-level</code> attribute can be used on elements with <code>listitem</code> role to represent list subitems when the structure of the DOM tree does not imply the intended level of nesting. For example, to quote a item in a nested to-do list, use the 'aria-level' attribute on the list items.</p>
6341
+
<p>
6342
+
The <code>aria-level</code> attribute can be used on elements with <code>listitem</code> role to represent list subitems when the structure of the DOM tree does not imply the intended level of nesting.
6343
+
For example, to quote a item in a nested to-do list, use the 'aria-level' attribute on the list items.
<p>The attribute <code>aria-level</code> can be used on elements with role <code>treeitem</code> to explicitly set the level of items within the <ahref="#TreeView">Tree View Design Pattern</a>.</p>
6341
-
<p>The computed <code>aria-level</code> of a <code>treeitem</code> within a tree is based on the number of 'group' role elements in the ancestor chain between the treeitem and the tree role, where the top level <code>treeitems</code> are <code>aria-level</code> 1. In the following example of a discussion board with nested replies, the top level post "What color should we paint the bike shed?" has an implicit <code>aria-level='1'</code>. The first reply has an implicit <code>aria-level='2'</code>, the response to that first reply has an implicit <code>aria-level='3'</code>.</p>
6357
+
<p>
6358
+
The computed <code>aria-level</code> of a <code>treeitem</code> within a tree is based on the number of 'group' role elements in the ancestor chain between the treeitem and the tree role, where the top level <code>treeitems</code> are <code>aria-level</code> 1.
6359
+
In the following example of a discussion board with nested replies, the top level post "What color should we paint the bike shed?" has an implicit <code>aria-level='1'</code>.
6360
+
The first reply has an implicit <code>aria-level='2'</code>, the response to that first reply has an implicit <code>aria-level='3'</code>.
<p>The <code>aria-level</code> attribute can be used on an element with <code>row</code> role to describe nesting of rows in a <code>treegrid</code>, as is explained in the <ahref="#treegrid">treegrid pattern</a>. In this example, the DOM tree does not represent the hierarchical relationship between rows. Each email is in a <code>tr</code> element, which are siblings in the DOM tree, therefore <code>aria-level</code> is necessary to communicate that the emails form a tree structure.</p>
6395
+
<p>
6396
+
The <code>aria-level</code> attribute can be used on an element with <code>row</code> role to describe nesting of rows in a <code>treegrid</code>, as is explained in the <ahref="#treegrid">treegrid pattern</a>.
6397
+
In this example, the DOM tree does not represent the hierarchical relationship between rows.
6398
+
Each email is in a <code>tr</code> element, which are siblings in the DOM tree, therefore <code>aria-level</code> is necessary to communicate that the emails form a tree structure.
0 commit comments