summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/wai-aria/role/menu-roles.html
blob: 4af4d8d2ff02c841178fd197430cc82d00239430 (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
<!doctype html>
<html>
<head>
    <title>Menu-related 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>
<style>
    /* Typically horizontal */
    [role="menubar"] {
        display: flex;
    }
</style>
<body>

<p>Tests <a href="https://w3c.github.io/aria/#menu">menu</a> and related roles.</p>

<div role="menu" data-testname="role is menu" data-expectedrole="menu" class="ex">
    <div role="menuitem" data-testname="role is menuitem (in menu)" data-expectedrole="menuitem" class="ex">x</div>
    <div role="menuitem">x</div>
    <div role="menuitem">x</div>
    <div role="group" data-testname="role is group (in menu)" data-expectedrole="group" class="ex">
        <div role="menuitem" data-testname="role is menuitem (in group, in menu)" data-expectedrole="menuitem" class="ex">x</div>
        <div role="menuitem">x</div>
    </div>
    <div role="group">
        <div role="menuitemradio" aria-checked="true" data-testname="role is menuitemradio (in group, in menu)" data-expectedrole="menuitemradio" class="ex">x</div>
        <div role="menuitemradio">x</div>
    </div>
    <div role="group">
        <div role="menuitemcheckbox" aria-checked="true" data-testname="role is menuitemcheckbox (in group, in menu)" data-expectedrole="menuitemcheckbox" class="ex">x</div>
        <div role="menuitemcheckbox">x</div>
    </div>
</div>

<div role="menubar" data-testname="role is menubar" data-expectedrole="menubar" class="ex">
    <div role="menuitem" data-testname="role is menuitem (in menubar)" data-expectedrole="menuitem" class="ex">x</div>
    <div role="menuitem">x</div>
    <div role="menuitem">x</div>
    <div role="group" data-testname="role is group (in menubar)" data-expectedrole="group" class="ex">
        <div role="menuitem" data-testname="role is menuitem (in group, in menubar)" data-expectedrole="menuitem" class="ex">x</div>
        <div role="menuitem">x</div>
    </div>
    <div role="group">
        <div role="menuitemradio" aria-checked="true" data-testname="role is menuitemradio (in group, in menubar)" data-expectedrole="menuitemradio" class="ex">x</div>
        <div role="menuitemradio">x</div>
    </div>
    <div role="group">
        <div role="menuitemcheckbox" aria-checked="true" data-testname="role is menuitemcheckbox (in group, in menubar)" data-expectedrole="menuitemcheckbox" class="ex">x</div>
        <div role="menuitemcheckbox">x</div>
    </div>
</div>

<nav role="menuitem" data-testname="orphaned menuitem outside the context of menu/menubar" data-expectedrole="navigation"
     class="ex">x
</nav>
<nav role="menuitemradio" data-testname="orphaned menuitemradio outside the context of menu/menubar" data-expectedrole="navigation"
     class="ex">x
</nav>
<nav role="menuitemcheckbox" data-testname="orphaned menuitemcheckbox outside the context of menu/menubar" data-expectedrole="navigation"
     class="ex">x
</nav>

<button role="menuitem" data-testname="orphan button with menuitem role" data-expectedrole="button" class="ex">x</button>
<div role="menuitem" data-testname="orphan div with menuitem role" class="ex-generic">x</div>

<button role="menuitemcheckbox" data-testname="orphan button with menuitemcheckbox role" data-expectedrole="button" class="ex">x</button>
<div role="menuitemcheckbox" data-testname="orphan div with menuitemcheckbox role" class="ex-generic">x</div>

<button role="menuitemradio" data-testname="orphan button with menuitemradio role" data-expectedrole="button" class="ex">x</button>
<div role="menuitemradio" data-testname="orphan div with menuitemradio role" class="ex-generic">x</div>

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

</body>
</html>