Skip to content

Commit 5d6012b

Browse files
authored
add normative expectations and examples for computedrole (#176)
Closes #174 Closes w3c/aria#1887 add normative expectations and examples for computedrole
1 parent 37697d3 commit 5d6012b

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

index.html

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,35 @@

General rules

344344
section>
345345
<section id="roleMappingComputedRole">
346346
<h2>Computed Roleh2>
347-
<p>The computed role of an element is a string that represents the role of the element for the purposes of specification comformance testing. When an element has a role but is not contained in the required context (for example, a role `listitem` used on an element outside of a `list`), the computed role of the element is unspecified.p>
348-
<p class="note">User agents can provide this role string, for example, in response to the WebDriver function <a href="https://w3c.github.io/webdriver/#get-computed-role">`getComputedRole`a>.p>
347+
<p>The `computedrole` of an element is a string that represents the role of the element as computed by the browser engine. The `computedrole` is used primarily for the purposes of developer tools and specification comformance and interoperability testing.p>
348+
<p class="note">User agents provide this role string, for example, in developer tools, and in response to the WebDriver function <a href="https://w3c.github.io/webdriver/#get-computed-role">`getComputedRole`a>, which is used for <a href="https://github.com/w3c/aria/blob/main/documentation/tests.md">interoperability testing of ARIA, HTML-AAM, and other specificationsa>.p>
349+
<aside class="example">
350+
351+
352+
<pre><button> <!-- computedrole returns "button" -->
353+
354+
<a href="#" role="button"> <!-- computedrole returns "button" -->pre>
355+
356+
aside>
357+
<p>When an element has a role but is not contained in the required context (for example, an orphaned `listitem` without the required accessible parent of role `list`), User Agents MUST ignore the role token, and return the `computedrole` as if the ignored role token had not been included.p>
358+
<aside class="example">
359+
360+
361+
<pre><div role="listitem"> <!-- Author error: orphaned listitem. computedrole returns "generic" -->
362+
363+
<div role="list"> <!-- computedrole returns "list" -->
364+
<div role="listitem"> <!-- computedrole returns "listitem" in the required context. -->pre>
365+
366+
aside>
367+
<p>When host language elements do not have an exact or equivalent mapping to a valid, non-abstract role, the related Accessibilty API Mapping extension specification MAY specify a unique `computedrole` string as the return value for interoperability testing purposes, such as `<video> -> "html-video"` in [[HTML-AAM]]. However, authors MUST NOT use any host-language-prefixed `computedrole` string in the `role` attribute (such as `html-video`), unless the token also matches valid, defined role (such as `dpub-chapter`). User Agents MUST ignore any abstract or invalid role token.p>
368+
<aside class="example">
369+
370+
371+
<pre><video> <!-- computedrole returns "html-video" -->
372+
373+
<main role="html-video"> <!-- Author error. computedrole returns "main" -->pre>
374+
375+
aside>
349376
section>
350377
<section id="mapping_role_table">
351378
<h3>Role Mapping Tableh3>

0 commit comments

Comments
 (0)