Skip to content

Commit d2b76bb

Browse files
authored
Apply suggestions from code review
1 parent 7f599ad commit d2b76bb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

aria-practices.html

+12-7
Original file line numberDiff line numberDiff line change
@@ -6829,15 +6829,17 @@ <h3>Using <code>aria-level</code> with the <code>treeitem</code> Role</h3>
68296829
Browsers automatically compute an <code>aria-level</code> value for elements with role <code>treeitem</code>.
68306830
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>.
68316831
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 <a href="#TreeView">Tree View Design Pattern</a>, it is necessary to explicitly declare the <code>aria-level</code>.
6832+
However, in some implementations of the <a href="#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>.
68336835
</p>
68346836
<p>
68356837
The following example shows a File Directory where a nested folder "report-1" is being viewed.
68366838
The parent folder "Reports" is at the top-level in the directory structure, and the "report-1" folder is level 2.
68376839
The files within the "report-1" folder are thus level 3, even though only these files are currently being viewed.
68386840
</p>
6839-
<pre><code>&lt;h3 id="tree_label">Viewing: report-1&lt;/h3>
6840-
&lt;ul role='tree' aria-labelledby='tree_label'&gt;
6841+
<pre><code>&lt;h2 id="tree_label">Viewing: report-1&lt;/h2>
6842+
&lt;ul role="tree" aria-labelledby="tree_label"&gt;
68416843
&lt;li role="treeitem" class="doc" aria-level="3">report-1A.docx&lt;/li>
68426844
&lt;li role="treeitem" class="doc" aria-level="3">report-1B.docx&lt;/li>
68436845
&lt;li role="treeitem" class="doc" aria-level="3">report-1C.docx&lt;/li>
@@ -6848,17 +6850,20 @@ <h3>Using <code>aria-level</code> with the <code>treeitem</code> Role</h3>
68486850

68496851
<section id="aria-level_row_role">
68506852
<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 <a href="#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>&lt;table role='treegrid'&gt;
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 <a href="#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>&lt;table role="treegrid"&gt;
68536858
&lt;tr&gt;
68546859
&lt;th&gt;From:&lt;/th&gt;
68556860
&lt;th&gt;Subject:&lt;/th&gt;
68566861
&lt;/tr&gt;
6857-
&lt;tr aria-level='1'&gt;
6862+
&lt;tr aria-level="1"&gt;
68586863
&lt;td&gt;Laura&lt;/td&gt;
68596864
&lt;td&gt;We should definitely cover the bike shed in rainbows.&lt;/td&gt;
68606865
&lt;/tr&gt;
6861-
&lt;tr aria-level='2'&gt;
6866+
&lt;tr aria-level="2"&gt;
68626867
&lt;td&gt;Fred&lt;/td&gt;
68636868
&lt;td&gt;Re: We should definitely cover the bike shed in rainbows.&lt;/td&gt;
68646869
&lt;/tr&gt;

0 commit comments

Comments
 (0)