summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/accname/name/comp_labelledby_hidden_nodes.html
blob: 97a8c3922015eead8c32f71423c7d91277315bea (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<!doctype html>
<html>
<head>
  <title>Name Comp: Labelledby & Hidden Nodes</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>Tests hidden node name computation as part of the <a href="https://w3c.github.io/accname/#comp_labelledby">#comp_labelledby</a> portion of the AccName <em>Name Computation</em> algorithm.</p>

<!--

  These tests verify browser conformance with the following note as part of accName computation Step 2B:

  "The result of LabelledBy Recursion in combination with Hidden Not Referenced means
  that user agents MUST include all nodes in the subtree as part of
  the accessible name or accessible description, when the node referenced
  by aria-labelledby or aria-describedby is hidden."

-->

<h2>Testing with <code>display:none</code></h2>

    <button aria-labelledby="a11" data-expectedlabel="foo bar" data-testname="button with aria-labelledby using display:none hidden span (with nested span)" class="ex">x</button>
    <span id="a11" style="display: none;">
        foo
        <span id="a12">bar</span>
    </span>

    <button aria-labelledby="a21" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using display:none hidden span (with nested spans, depth 2)" class="ex">x</button>
    <span id="a21" style="display: none;">
        foo
        <span id="a22">
            bar
            <span id="a23">baz</span>
        </span>
    </span>

    <button aria-labelledby="a31" data-expectedlabel="foo" data-testname="button with aria-labelledby using span without display:none (with nested display:none spans, depth 2)" class="ex">x</button>
    <span id="a31">
        foo
        <span id="a32" style="display: none;">
            bar
            <span id="a33">baz</span>
        </span>
    </span>

    <button aria-labelledby="a41" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using display:none hidden span (with nested sibling spans)" class="ex">x</button>
    <span id="a41" style="display: none;">
        foo
        <span id="a42">bar</span>
        <span id="a43">baz</span>
    </span>

    <button aria-labelledby="a51" data-expectedlabel="foo" data-testname="button with aria-labelledby using span without display:none (with nested display:none sibling spans)" class="ex">x</button>
    <span id="a51">
        foo
        <span id="a52" style="display: none;">bar</span>
        <span id="a53" style="display: none;">baz</span>
    </span>

    <button aria-labelledby="a61" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using span with display:none (with nested display:inline sibling spans)" class="ex">x</button>
    <span id="a61" style="display: none;">
        foo
        <span id="a62" style="display: inline;">bar</span>
        <span id="a63" style="display: inline;">baz</span>
    </span>

<h2>Testing with <code>visibility:hidden</code></h2>

    <button aria-labelledby="b11" data-expectedlabel="foo bar" data-testname="button with aria-labelledby using visibility:hidden span (with nested span)" class="ex">x</button>
    <span id="b11" style="visibility: hidden;">
        foo
        <span id="b12">bar</span>
    </span>

    <button aria-labelledby="b21" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using visibility:hidden span (with nested spans, depth 2)" class="ex">x</button>
    <span id="b21" style="visibility: hidden;">
        foo
        <span id="b22">
            bar
            <span id="b23">baz</span>
        </span>
    </span>

    <button aria-labelledby="b31" data-expectedlabel="foo" data-testname="button with aria-labelledby using span without visibility:hidden (with nested visibility:hidden spans, depth 2)" class="ex">x</button>
    <span id="b31">
        foo
        <span id="b32" style="visibility: hidden;">
            bar
            <span id="b33">baz</span>
        </span>
    </span>

    <button aria-labelledby="b41" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using visibility:hidden hidden span (with nested sibling spans)" class="ex">x</button>
    <span id="b41" style="visibility: hidden;">
        foo
        <span id="b42">bar</span>
        <span id="b43">baz</span>
    </span>

    <button aria-labelledby="b51" data-expectedlabel="foo" data-testname="button with aria-labelledby using span without visibility:hidden (with nested visibility:hidden sibling spans)" class="ex">x</button>
    <span id="b51">
        foo
        <span id="b52" style="visibility: hidden;">bar</span>
        <span id="b53" style="visibility: hidden;">baz</span>
    </span>

    <button aria-labelledby="b61" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using span with visibility:hidden (with nested visibility:visible sibling spans)" class="ex">x</button>
    <span id="b61" style="visibility: hidden;">
        foo
        <span id="b62" style="visibility: visible;">bar</span>
        <span id="b63" style="visibility: visible;">baz</span>
    </span>

<h2>Testing with <code>visibility:collapse</code></h2>

    <button aria-labelledby="c11" data-expectedlabel="foo bar" data-testname="button with aria-labelledby using visibility:collapse span (with nested span)" class="ex">x</button>
    <span id="c11" style="visibility: collapse;">
        foo
        <span id="c12">bar</span>
    </span>

    <button aria-labelledby="c21" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using visibility:collapse span (with nested spans, depth 2)" class="ex">x</button>
    <span id="c21" style="visibility: collapse;">
        foo
        <span id="c22">
            bar
            <span id="c23">baz</span>
        </span>
    </span>

    <button aria-labelledby="c31" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using span without visibility:collapse (with nested visibility:visible spans, depth 2)" class="ex">x</button>
    <span id="c31">
        foo
        <span id="c32" style="visibility: visible;">
            bar
            <span id="c33" style="visibility: visible;">baz</span>
        </span>
    </span>

    <button aria-labelledby="c41" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using visibility:collapse span (with nested sibling spans)" class="ex">x</button>
    <span id="c41" style="visibility: collapse;">
        foo
        <span id="c42">bar</span>
        <span id="c43">baz</span>
    </span>

    <button aria-labelledby="c51" data-expectedlabel="foo" data-testname="button with aria-labelledby using span without visibility:collapse (with nested visibility:collapse sibling spans)" class="ex">x</button>
    <span id="c51">
        foo
        <span id="c52" style="visibility: collapse;">bar</span>
        <span id="c53" style="visibility: collapse;">baz</span>
    </span>

    <button aria-labelledby="c61" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using span with visibility:collapse (with nested visible sibling spans)" class="ex">x</button>
    <span id="c61" style="visibility: collapse;">
        foo
        <span id="c62" style="visibility: visible;">bar</span>
        <span id="c63" style="visibility: visible;">baz</span>
    </span>

<h2>Testing with <code>aria-hidden</code></h2>

    <button aria-labelledby="d11" data-expectedlabel="foo bar" data-testname="button with aria-labelledby using aria-hidden span (with nested span)" class="ex">x</button>
    <span id="d11" aria-hidden="true">
        foo
        <span id="d12">bar</span>
    </span>

    <button aria-labelledby="d21" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using aria-hidden span (with nested spans, depth 2)" class="ex">x</button>
    <span id="d21" aria-hidden="true">
        foo
        <span id="d22">
            bar
            <span id="d23">baz</span>
        </span>
    </span>

    <button aria-labelledby="d31" data-expectedlabel="foo" data-testname="button with aria-labelledby using span without aria-hidden (with nested aria-hidden spans, depth 2)" class="ex">x</button>
    <span id="d31">
        foo
        <span id="d32" aria-hidden="true">
            bar
            <span id="d33">baz</span>
        </span>
    </span>

    <button aria-labelledby="d41" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using aria-hidden hidden span (with nested sibling spans)" class="ex">x</button>
    <span id="d41" aria-hidden="true">
        foo
        <span id="d42">bar</span>
        <span id="d43">baz</span>
    </span>

<h2>Testing with <code>hidden</code> attribute</h2>

    <button aria-labelledby="e11" data-expectedlabel="foo bar" data-testname="button with aria-labelledby using HTML5 hidden span (with nested span)" class="ex">x</button>
    <span id="e11" hidden>
        foo
        <span id="e12">bar</span>
    </span>

    <button aria-labelledby="e21" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using HTML5 hidden span (with nested spans, depth 2)" class="ex">x</button>
    <span id="e21" hidden>
        foo
        <span id="e22">
            bar
            <span id="e23">baz</span>
        </span>
    </span>

    <button aria-labelledby="e31" data-expectedlabel="foo" data-testname="button with aria-labelledby using span without HTML5 hidden (with nested HTML5 hidden spans, depth 2)" class="ex">x</button>
    <span id="e31">
        foo
        <span id="e32" hidden>
            bar
            <span id="e33">baz</span>
        </span>
    </span>

    <button aria-labelledby="e41" data-expectedlabel="foo bar baz" data-testname="button with aria-labelledby using HTML5 hidden span (with nested hidden sibling spans)" class="ex">x</button>
    <span id="e41" hidden>
        foo
        <span id="e42">bar</span>
        <span id="e43">baz</span>
    </span>

    <button aria-labelledby="e51" data-expectedlabel="foo" data-testname="button with aria-labelledby using span without HTML5 hidden (with nested hidden sibling spans)" class="ex">x</button>
    <span id="e51">
        foo
        <span id="e52" hidden>bar</span>
        <span id="e53" hidden>baz</span>
    </span>

<script>
AriaUtils.verifyLabelsBySelector(".ex");
</script>
</body>
</html>