Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: change default role for custom elements #2383

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
55 changes: 49 additions & 6 deletions html-aam/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ <h3>HTML Element Role Mappings</h3>
specified which would require a more specific <a>minimum role</a> to be exposed.
</li>
<li>
Where an element is indicated as having &quot;No corresponding (WAI-ARIA) role&quot;, or is mapped to the <a class="core-mapping" href="#role-map-generic">`generic`</a> role, user agents
Where an element is indicated as having &quot;No corresponding (WAI-ARIA) role&quot;, or is mapped to the <a class="core-mapping" href="#role-map-generic">`generic`</a>
or <a class="core-mapping" href="#role-map-none">`none`</a> roles, user agents
MUST NOT expose the <a class="core-mapping" href="#ariaRoleDescription">`aria-roledescription`</a> property value in the <a class="termref">accessibility tree</a> unless the element has an
explicit, conforming `role` attribute value which [[WAI-ARIA-1.2]] does not prohibit the use of `aria-roledescription`.
</li>
Expand Down Expand Up @@ -815,7 +816,19 @@ <h4 id="el-autonomous-custom-element">autonomous custom element</h4>
</tr>
<tr>
<th>[[wai-aria-1.2]]</th>
<td>If the author assigned a conforming ARIA role using the `role` attribute, map to that role. Otherwise, the <a class="core-mapping" href="#role-map-generic">`generic`</a> role.</td>
<td>
<p>
If the author assigned a conforming ARIA role using the `role` attribute,
or by the custom element's internals, map to the specified role.
</p>
<p>
If the author assigned attributes that result in a <a>minimum role</a>, then map
to the minimum role (see <a href="#custom-element-comments">comments</a>).
</p>
<p>
Otherwise, the element maps to the <a class="core-mapping" href="#role-map-none">`none`</a> role.
</p>
</td>
</tr>
<tr>
<th><a data-cite="core-aam-1.2/#roleMappingComputedRole">Computed Role</a></th>
Expand Down Expand Up @@ -849,8 +862,38 @@ <h4 id="el-autonomous-custom-element">autonomous custom element</h4>
</tr>
<!-- <th><a href="#accessible-name-and-description-computation">Naming Algorithm</a></th> -->
<tr>
<th>Comments</th>
<td></td>
<th id=custom-element-comments>Comments</th>
<td>
<p>
Along with the attributes defined in this specification that participate in modifying an element's <a>minimum role</a>,
the following conditions will also alter a custom element's computed role, if an author has not otherwise specified an
explicit role for the element:
</p>
<ul>
<li>if the custom element is focusable: expose as <a class="core-mapping" href="#role-map-group">`group`</a> role</li>
<li>if the custom element has an `aria-live` attribute: expose as <a class="core-mapping" href="#role-map-generic">`generic`</a> role</li>
<li>if element internals are used to set a global ARIA property: expose as <a class="core-mapping" href="#role-map-generic">`generic`</a> role</li>
<li>if an author specifies an ARIA attribute that creates a relation with another element: expose <a class="core-mapping" href="#role-map-generic">`generic`</a> role</li>
scottaohara marked this conversation as resolved.
Show resolved Hide resolved
</ul>
<div class="example">
<p>The following are exmaples of an author specifiying a relationships between custom elements and other elements in the DOM.</p>
<pre><code>
&lt;my-element aria-details=ex>...&lt;/my-element>
...
&lt;div id=ex> &lt;!-- details for my-element --> &lt;/div>
...
&lt;ex-ample aria-owns=u>...&lt;/ex-ample>
...
&lt;div id=u> &lt;!-- becomes the last a11y child of ex-ample --> &lt;/div>

&lt;id-lement> ... &lt;/id-lement>
&lt;script>
...
document.querySelector('id-lement').ariaDescribedby = anotherEl;
scottaohara marked this conversation as resolved.
Show resolved Hide resolved
&lt;/script>
</code></pre>
</div>
</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -8680,7 +8723,7 @@ <h4 id="att-autofocus">`autofocus`</h4>
</tr>
<tr>
<th>Comments</th>
<td>Provides a <a href="termref">minimum role</a> of <a class="core-mapping" href="#role-map-group">`group`</a>.</td>
<td>Provides a <a>minimum role</a> of <a class="core-mapping" href="#role-map-group">`group`</a>.</td>
scottaohara marked this conversation as resolved.
Show resolved Hide resolved
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -10171,7 +10214,7 @@ <h4 id="att-draggable">`draggable`</h4>
</tr>
<tr>
<th>Comments</th>
<td>Provides a <a href="termref">minimum role</a> of <a class="core-mapping" href="#role-map-group">`group`</a>.</td>
<td>Provides a <a>minimum role</a> of <a class="core-mapping" href="#role-map-group">`group`</a>.</td>
</tr>
</tbody>
</table>
Expand Down
Loading