summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/wai-aria/role/contextual-roles.html
blob: ff5c073e95464da129aa8e4f809b6c69d76441c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!doctype html>
<html>
<head>
  <title>Contextual Role Verification Tests</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="/resources/testdriver.js"></script>
  <script src="/resources/testdriver-vendor.js"></script>
  <script src="/resources/testdriver-actions.js"></script>
  <script src="/wai-aria/scripts/aria-utils.js"></script>
</head>
<body>

    <p>Verifies Required Accessibility Parent Roles from <a href="https://w3c.github.io/aria/#scope">5.2.7 Required Accessibility Parent Role</a></p>
    <p>Also verifies Allowed Accessibility Child Roles from <a href="https://w3c.github.io/aria/#mustContain">5.2.6 Allowed Accessibility Child Roles</a></p>

<!-- Notes for "required context" testing:

    - See Computed Role for more details on role computation when an element lacks required context:
    https://w3c.github.io/core-aam/#roleMappingComputedRole

    - See ARIA spec for full listing of "Required Accessibility Parent Role" for each element:
    https://w3c.github.io/aria/#scope

    Identified roles with "Required Context" excluding abstract roles (e.g., child -> parent):

    - caption -> {figure, grid, table, treegrid}
    - cell -> row
    - columnheader -> row
    - gridcell -> row
    - listitem -> {list, directory} *Note: directory role is deprecated as of ARIA 1.2
    - menuitem -> {group, menu, menubar}
    - menuitemcheckbox -> {group, menu, menubar}
    - menuitemradio -> {group, menu, menubar}
    - option -> {group, listbox}
    - row -> {grid, rowgroup, table, treegrid}
    - rowgroup -> {grid, table, treegrid}
    - rowheader -> row
    - tab -> tablist
    - treeitem -> {group, tree}

    -->

<!-- Required Context Roles Testing  -->

    <!-- caption -> ./table-roles.html -->

    <!-- cell -> ./table-roles.html -->

    <!-- columnheader -> ./grid-roles.html, ./table-roles.html -->

    <!-- gridcell -> ./grid-roles.html -->

    <!-- listitem -> ./list-roles.html -->

    <!-- menuitem, menuitemcheckbox, menuitemradio -> ./menu-roles.html -->

    <!-- option -> ./listbox-roles.html -->

    <!-- row -> ./grid-roles.html, ./table-roles.html  -->

    <!-- rowgroup -> ./grid-roles.html, ./table-roles.html -->

    <!-- rowheader -> ./grid-roles.html, ./table-roles.html -->

    <!-- tab -> ./tab-roles.html -->

    <!-- treeitem -> ./tree-roles.html -->

<!-- Misc Contextual Role Testing  -->

    <!-- Testing contentinfo role computation when scoped to <main> or not:
    1. If <footer> is a descendant of <main>, it should become 'generic'
    2. If <footer> is scoped to <body>, it should be 'contentinfo' as expected

    see: https://w3c.github.io/html-aam/#el-footer-ancestorbody -->
    <main>
        <footer data-testname="footer element scoped to main element is generic" class="ex-generic">x</footer>
    </main>

    <footer data-testname="footer scoped to body element is contentinfo" data-expectedrole="contentinfo" class="ex">x</footer>
    <div role="contentinfo" data-testname="contentinfo region scoped to body element is contentinfo" data-expectedrole="contentinfo" class="ex">x</div>

<script>
    AriaUtils.verifyRolesBySelector(".ex");
    AriaUtils.verifyGenericRolesBySelector(".ex-generic");
</script>

</body>
</html>