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
+12-7
Original file line number
Diff line number
Diff line change
@@ -6829,15 +6829,17 @@ <h3>Using <code>aria-level</code> with the <code>treeitem</code> Role</h3>
6829
6829
Browsers automatically compute an <code>aria-level</code> value for elements with role <code>treeitem</code>.
6830
6830
The computed level for a <code>treeitem</code> element is based on the number of <code>group</code> elements in the ancestor chain between that <code>treeitem</code> and the element with role <code>tree</code>.
6831
6831
The top-level <code>treeitem</code> elements, which are immediate descendants of the <code>tree</code> with no intervening <code>group</code>, have <code>aria-level</code> of <code>1</code>.
6832
-
However, in some implementations of the <ahref="#TreeView">Tree View Design Pattern</a>, it is necessary to explicitly declare the <code>aria-level</code>.
6832
+
However, in some implementations of the <ahref="#TreeView">Tree View Design Pattern</a>
6833
+
when the DOM structure does not represent the actual level and the level is important for understanding the content or actions of the treeitem,
6834
+
it is necessary to explicitly declare the <code>aria-level</code>.
6833
6835
</p>
6834
6836
<p>
6835
6837
The following example shows a File Directory where a nested folder "report-1" is being viewed.
6836
6838
The parent folder "Reports" is at the top-level in the directory structure, and the "report-1" folder is level 2.
6837
6839
The files within the "report-1" folder are thus level 3, even though only these files are currently being viewed.
@@ -6848,17 +6850,20 @@ <h3>Using <code>aria-level</code> with the <code>treeitem</code> Role</h3>
6848
6850
6849
6851
<sectionid="aria-level_row_role">
6850
6852
<h3>Using <code>aria-level</code> with the <code>row</code> Role</h3>
6851
-
<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 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>
6852
-
<pre><code><table role='treegrid'>
6853
+
<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 explained in the <ahref="#treegrid">treegrid pattern</a>.
6854
+
In this example, the DOM tree does not represent the hierarchical relationship between rows.
6855
+
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.
6856
+
The rows with <code>aria-level="2"</code> represent responses to the last previous row with <code>aria-level="1"</code> and visually this relationship is typically displayed the rows with <code>aria-level="2"</code> indented. <code>aria-level</code> in this example is providing the information of the response relationship that is represented visually by indenting.</p>
6857
+
<pre><code><table role="treegrid">
6853
6858
<tr>
6854
6859
<th>From:</th>
6855
6860
<th>Subject:</th>
6856
6861
</tr>
6857
-
<tr aria-level='1'>
6862
+
<tr aria-level="1">
6858
6863
<td>Laura</td>
6859
6864
<td>We should definitely cover the bike shed in rainbows.</td>
6860
6865
</tr>
6861
-
<tr aria-level='2'>
6866
+
<tr aria-level="2">
6862
6867
<td>Fred</td>
6863
6868
<td>Re: We should definitely cover the bike shed in rainbows.</td>
0 commit comments