accessible/tests/mochitest/name/test_general.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <html>
michael@0 2
michael@0 3 <head>
michael@0 4 <title>nsIAccessible::name calculation</title>
michael@0 5 <link rel="stylesheet" type="text/css"
michael@0 6 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
michael@0 7
michael@0 8 <script type="application/javascript"
michael@0 9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10
michael@0 11 <script type="application/javascript"
michael@0 12 src="../common.js"></script>
michael@0 13 <script type="application/javascript"
michael@0 14 src="../name.js"></script>
michael@0 15
michael@0 16 <script type="application/javascript">
michael@0 17
michael@0 18 function doTest()
michael@0 19 {
michael@0 20 // aria-label
michael@0 21
michael@0 22 // Simple label provided via ARIA
michael@0 23 testName("btn_simple_aria_label", "I am a button");
michael@0 24
michael@0 25 // aria-label and aria-labelledby, expect aria-labelledby
michael@0 26 testName("btn_both_aria_labels", "text I am a button, two");
michael@0 27
michael@0 28 //////////////////////////////////////////////////////////////////////////
michael@0 29 // aria-labelledby
michael@0 30
michael@0 31 // Single relation. The value of 'aria-labelledby' contains the ID of
michael@0 32 // an element. Gets the name from text node of that element.
michael@0 33 testName("btn_labelledby_text", "text");
michael@0 34
michael@0 35 // Multiple relations. The value of 'aria-labelledby' contains the IDs
michael@0 36 // of elements. Gets the name from text nodes of those elements.
michael@0 37 testName("btn_labelledby_texts", "text1 text2");
michael@0 38
michael@0 39 //////////////////////////////////////////////////////////////////////////
michael@0 40 // Name from named accessible
michael@0 41
michael@0 42 testName("input_labelledby_namedacc", "Data");
michael@0 43
michael@0 44 //////////////////////////////////////////////////////////////////////////
michael@0 45 // Name from subtree (single relation labelled_by).
michael@0 46
michael@0 47 // Gets the name from text nodes contained by nested elements
michael@0 48 testName("btn_labelledby_mixed", "nomore text");
michael@0 49
michael@0 50 // Gets the name from text nodes contained by nested elements, ignores
michael@0 51 // hidden elements (bug 443081).
michael@0 52 testName("btn_labelledby_mixed_hidden_child", "nomore text2");
michael@0 53
michael@0 54 // Gets the name from hidden text nodes contained by nested elements,
michael@0 55 // (label element is hidden entirely), (bug 443081).
michael@0 56 testName("btn_labelledby_mixed_hidden", "lala more hidden text");
michael@0 57
michael@0 58 // Gets the name from text nodes contained by nested elements having block
michael@0 59 // representation (every text node value in the name should be devided by
michael@0 60 // spaces)
michael@0 61 testName("btn_labelledby_mixed_block", "text more text");
michael@0 62
michael@0 63 // Gets the name from text nodes contained by html:td (every text node
michael@0 64 // value in the name should be devided by spaces).
michael@0 65 // XXX: this case is rather a feature than strong wanted behaviour.
michael@0 66 testName("btn_labelledby_mixed_table", "text space text");
michael@0 67
michael@0 68 // Gets the name from image accessible.
michael@0 69 testName("btn_labelledby_mixed_img", "text image");
michael@0 70
michael@0 71 // Gets the name from input accessibles
michael@0 72 // Note: if input have label elements then the name isn't calculated
michael@0 73 // from them.
michael@0 74 testName("btn_labelledby_mixed_input",
michael@0 75 "input button Submit Query Reset Submit Query");
michael@0 76
michael@0 77 // Gets the name from the title of object element.
michael@0 78 testName("btn_labelledby_mixed_object", "object");
michael@0 79
michael@0 80 // Gets the name from text nodes. Element br adds space between them.
michael@0 81 testName("btn_labelledby_mixed_br", "text text");
michael@0 82
michael@0 83 // Gets the name from label content which allows name from subtree,
michael@0 84 // ignore @title attribute on label
michael@0 85 testName("from_label_ignoretitle", "Country:");
michael@0 86
michael@0 87 // Gets the name from html:p content, which doesn't allow name from
michael@0 88 // subtree, ignore @title attribute on label
michael@0 89 testName("from_p_ignoretitle", "Choose country from.");
michael@0 90
michael@0 91 // Gets the name from html:input value, ignore @title attribute on input
michael@0 92 testName("from_input_ignoretitle", "Custom country");
michael@0 93
michael@0 94 // Insert spaces around the control's value to not jamm sibling text nodes
michael@0 95 testName("insert_spaces_around_control", "start value end");
michael@0 96
michael@0 97 // Gets the name from @title, ignore whitespace content
michael@0 98 testName("from_label_ignore_ws_subtree", "about");
michael@0 99
michael@0 100 //////////////////////////////////////////////////////////////////////////
michael@0 101 // label element
michael@0 102
michael@0 103 // The label element contains the button. The name is calculated from
michael@0 104 // this button.
michael@0 105 // Note: the name contains the content of the button.
michael@0 106 testName("btn_label_inside", "text10text");
michael@0 107
michael@0 108 // The label element and the button are placed in the same form. Gets
michael@0 109 // the name from the label subtree.
michael@0 110 testName("btn_label_inform", "in form");
michael@0 111
michael@0 112 // The label element is placed outside of form where the button is.
michael@0 113 // Take into account the label.
michael@0 114 testName("btn_label_outform", "out form");
michael@0 115
michael@0 116 // The label element and the button are in the same document. Gets the
michael@0 117 // name from the label subtree.
michael@0 118 testName("btn_label_indocument", "in document");
michael@0 119
michael@0 120 // Multiple label elements for single button
michael@0 121 testName("btn_label_multi", "label1label2");
michael@0 122
michael@0 123
michael@0 124 //////////////////////////////////////////////////////////////////////////
michael@0 125 // name from children
michael@0 126
michael@0 127 // ARIA role button is presented allowing the name calculation from
michael@0 128 // children.
michael@0 129 testName("btn_children", "14");
michael@0 130
michael@0 131 // html:button, no name from content
michael@0 132 testName("btn_nonamefromcontent", null);
michael@0 133
michael@0 134 // ARIA role option is presented allowing the name calculation from
michael@0 135 // visible children (bug 443081).
michael@0 136 testName("lb_opt1_children_hidden", "i am visible");
michael@0 137
michael@0 138 // Get the name from subtree of menuitem crossing role nothing to get
michael@0 139 // the name from its children.
michael@0 140 testName("tablemenuitem", "menuitem 1");
michael@0 141
michael@0 142 // Get the name from child acronym title attribute rather than from
michael@0 143 // acronym content.
michael@0 144 testName("label_with_acronym", "O A T F World Wide Web");
michael@0 145
michael@0 146 testName("testArticle", "Test article");
michael@0 147
michael@0 148 //////////////////////////////////////////////////////////////////////////
michael@0 149 // title attribute
michael@0 150
michael@0 151 // If nothing is left. Let's try title attribute.
michael@0 152 testName("btn_title", "title");
michael@0 153
michael@0 154 //////////////////////////////////////////////////////////////////////////
michael@0 155 // textarea name
michael@0 156
michael@0 157 // textarea's name should have the value, which initially is specified by
michael@0 158 // a text child.
michael@0 159 testName("textareawithchild", "Story Foo is ended.");
michael@0 160
michael@0 161 // new textarea name should reflect the value change.
michael@0 162 var elem = document.getElementById("textareawithchild");
michael@0 163 elem.value = "Bar";
michael@0 164
michael@0 165 testName("textareawithchild", "Story Bar is ended.");
michael@0 166
michael@0 167 //////////////////////////////////////////////////////////////////////////
michael@0 168 // controls having a value used as a part of computed name
michael@0 169
michael@0 170 testName("ctrlvalue_progressbar:input", "foo 5 baz");
michael@0 171 testName("ctrlvalue_scrollbar:input", "foo 5 baz");
michael@0 172 testName("ctrlvalue_slider:input", "foo 5 baz");
michael@0 173 testName("ctrlvalue_spinbutton:input", "foo 5 baz");
michael@0 174 testName("ctrlvalue_combobox:input", "foo 5 baz");
michael@0 175
michael@0 176
michael@0 177 /////////////////////////////////////////////////////////////////////////
michael@0 178 // label with nested combobox (test for 'f' item of name computation guide)
michael@0 179
michael@0 180 testName("comboinstart", "One day(s).");
michael@0 181 testName("combo3", "day(s).");
michael@0 182
michael@0 183 testName("textboxinstart", "Two days.");
michael@0 184 testName("textbox1", "days.");
michael@0 185
michael@0 186 testName("comboinmiddle", "Subscribe to ATOM feed.");
michael@0 187 testName("combo4", "Subscribe to ATOM feed.");
michael@0 188
michael@0 189 testName("comboinmiddle2", "Play the Haliluya sound when new mail arrives");
michael@0 190 testName("combo5", null); // label isn't used as a name for control
michael@0 191 testName("checkbox", "Play the Haliluya sound when new mail arrives");
michael@0 192 testName("comboinmiddle3", "Play the Haliluya sound when new mail arrives");
michael@0 193 testName("combo6", "Play the Haliluya sound when new mail arrives");
michael@0 194
michael@0 195 testName("comboinend", "This day was sunny");
michael@0 196 testName("combo7", "This day was");
michael@0 197
michael@0 198 testName("textboxinend", "This day was sunny");
michael@0 199 testName("textbox2", "This day was");
michael@0 200
michael@0 201 // placeholder
michael@0 202 testName("ph_password", "a placeholder");
michael@0 203 testName("ph_text", "a placeholder");
michael@0 204 testName("ph_textarea", "a placeholder");
michael@0 205 testName("ph_text2", "a label");
michael@0 206 testName("ph_textarea2", "a label");
michael@0 207 testName("ph_text3", "a label");
michael@0 208
michael@0 209 // Test equation image
michael@0 210 testName("img_eq", "x^2 + y^2 + z^2")
michael@0 211 testName("input_img_eq", "x^2 + y^2 + z^2")
michael@0 212 testName("txt_eq", "x^2 + y^2 + z^2")
michael@0 213
michael@0 214 ////////////////////////////////////////////////////////////////////////
michael@0 215 // tests for duplicate announcement of content
michael@0 216
michael@0 217 testName("test_note", null);
michael@0 218
michael@0 219 SimpleTest.finish();
michael@0 220 }
michael@0 221
michael@0 222 SimpleTest.waitForExplicitFinish();
michael@0 223 addA11yLoadEvent(doTest);
michael@0 224 </script>
michael@0 225
michael@0 226 </head>
michael@0 227
michael@0 228 <body>
michael@0 229
michael@0 230 <a target="_blank"
michael@0 231 href="https://bugzilla.mozilla.org/show_bug.cgi?id=428479"
michael@0 232 title="Bug 428479 - Support ARIA role=math">
michael@0 233 Bug 428479
michael@0 234 </a>
michael@0 235 <a target="_blank"
michael@0 236 href="https://bugzilla.mozilla.org/show_bug.cgi?id=429666"
michael@0 237 title="Expose ROLE_DOCUMENT for ARIA landmarks that inherit from document">
michael@0 238 Bug 429666
michael@0 239 </a>
michael@0 240 <a target="_blank"
michael@0 241 href="https://bugzilla.mozilla.org/show_bug.cgi?id=444279"
michael@0 242 title="mochitest for accessible name calculating">
michael@0 243 Bug 444279
michael@0 244 </a>
michael@0 245 <a target="_blank"
michael@0 246 href="https://bugzilla.mozilla.org/show_bug.cgi?id=459635"
michael@0 247 title="nsIAccessible::name calculation for HTML buttons">
michael@0 248 Bug 459635
michael@0 249 </a>
michael@0 250 <a target="_blank"
michael@0 251 href="https://bugzilla.mozilla.org/show_bug.cgi?id=530081"
michael@0 252 title="Clean up our tree walker">
michael@0 253 Bug 530081
michael@0 254 </a><br>
michael@0 255 <a target="_blank"
michael@0 256 href="https://bugzilla.mozilla.org/show_bug.cgi?id=604391"
michael@0 257 title="Use placeholder as name if name is otherwise empty">
michael@0 258 Bug 604391
michael@0 259 </a>
michael@0 260 <a target="_blank"
michael@0 261 href="https://bugzilla.mozilla.org/show_bug.cgi?id=669312"
michael@0 262 title="Accessible name is duplicated when input has a label associated uisng for/id and is wrapped around the input">
michael@0 263 Bug 669312
michael@0 264 </a>
michael@0 265 <a target="_blank"
michael@0 266 href="https://bugzilla.mozilla.org/show_bug.cgi?id=704416"
michael@0 267 title="HTML acronym and abbr names should be provided by @title">
michael@0 268 Bug 704416
michael@0 269 </a>
michael@0 270 <a target="_blank"
michael@0 271 href="https://bugzilla.mozilla.org/show_bug.cgi?id=812041"
michael@0 272 title="ARIA slider and spinbutton don't provide a value for name computation">
michael@0 273 Bug 812041
michael@0 274 </a>
michael@0 275 <a target="_blank"
michael@0 276 href="https://bugzilla.mozilla.org/show_bug.cgi?id=823927"
michael@0 277 title="Text is jammed with control's text in name computation">
michael@0 278 Bug 823927
michael@0 279 </a>
michael@0 280 <a target="_blank"
michael@0 281 href="https://bugzilla.mozilla.org/show_bug.cgi?id=835666"
michael@0 282 title="ARIA combobox selected value is not a part of name computation">
michael@0 283 Bug 835666
michael@0 284 </a>
michael@0 285 <a target="_blank"
michael@0 286 href="https://bugzilla.mozilla.org/show_bug.cgi?id=833256"
michael@0 287 title="role note shouldn't pick up the name from subtree">
michael@0 288 Mozilla Bug 833256
michael@0 289 </a>
michael@0 290 <p id="display"></p>
michael@0 291 <div id="content" style="display: none"></div>
michael@0 292 <pre id="test">
michael@0 293 </pre>
michael@0 294
michael@0 295 <!-- aria-label, simple label -->
michael@0 296 <span id="btn_simple_aria_label" role="button" aria-label="I am a button"/>
michael@0 297 <br/>
michael@0 298 <!-- aria-label plus aria-labelledby -->
michael@0 299 <span id="btn_both_aria_labels" role="button" aria-label="I am a button, two"
michael@0 300 aria-labelledby="labelledby_text btn_both_aria_labels"/>
michael@0 301 <br/>
michael@0 302
michael@0 303 <!-- aria-labelledby, single relation -->
michael@0 304 <span id="labelledby_text">text</span>
michael@0 305 <button id="btn_labelledby_text"
michael@0 306 aria-labelledby="labelledby_text">1</button>
michael@0 307 <br/>
michael@0 308
michael@0 309 <!-- aria-labelledby, multiple relations -->
michael@0 310 <span id="labelledby_text1">text1</span>
michael@0 311 <span id="labelledby_text2">text2</span>
michael@0 312 <button id="btn_labelledby_texts"
michael@0 313 aria-labelledby="labelledby_text1 labelledby_text2">2</button>
michael@0 314 <br/>
michael@0 315
michael@0 316 <!-- name from named accessible -->
michael@0 317 <input id="labelledby_namedacc" type="checkbox"
michael@0 318 aria-label="Data" />
michael@0 319 <input id="input_labelledby_namedacc"
michael@0 320 aria-labelledby="labelledby_namedacc" />
michael@0 321
michael@0 322 <!-- the name from subtree, mixed content -->
michael@0 323 <span id="labelledby_mixed">no<span>more text</span></span>
michael@0 324 <button id="btn_labelledby_mixed"
michael@0 325 aria-labelledby="labelledby_mixed">3</button>
michael@0 326 <br/>
michael@0 327
michael@0 328 <!-- the name from subtree, mixed/hidden content -->
michael@0 329 <span id="labelledby_mixed_hidden_child">
michael@0 330 no<span>more
michael@0 331 <span style="display: none;">hidden</span>
michael@0 332 text2
michael@0 333 <span style="visibility: hidden">hidden2</span>
michael@0 334 </span>
michael@0 335 </span>
michael@0 336 <button id="btn_labelledby_mixed_hidden_child"
michael@0 337 aria-labelledby="labelledby_mixed_hidden_child">3.1</button>
michael@0 338 <br/>
michael@0 339
michael@0 340 <!-- the name from subtree, mixed/completely hidden content -->
michael@0 341 <span id="labelledby_mixed_hidden"
michael@0 342 style="display: none;">lala <span>more hidden </span>text</span></span>
michael@0 343 <button id="btn_labelledby_mixed_hidden"
michael@0 344 aria-labelledby="labelledby_mixed_hidden">3.2</button>
michael@0 345 <br/>
michael@0 346
michael@0 347 <!-- the name from subtree, mixed content, block structure -->
michael@0 348 <div id="labelledby_mixed_block"><div>text</div>more text</div></div>
michael@0 349 <button id="btn_labelledby_mixed_block"
michael@0 350 aria-labelledby="labelledby_mixed_block">4</button>
michael@0 351 <br/>
michael@0 352
michael@0 353 <!-- the name from subtree, mixed content, table structure -->
michael@0 354 <table><tr>
michael@0 355 <td id="labelledby_mixed_table">text<span>space</span>text</td>
michael@0 356 </tr></table>
michael@0 357 <button id="btn_labelledby_mixed_table"
michael@0 358 aria-labelledby="labelledby_mixed_table">5</button>
michael@0 359 <br/>
michael@0 360
michael@0 361 <!-- the name from subtree, child img -->
michael@0 362 <span id="labelledby_mixed_img">text<img alt="image"/></span>
michael@0 363 <button id="btn_labelledby_mixed_img"
michael@0 364 aria-labelledby="labelledby_mixed_img">6</button>
michael@0 365 <br/>
michael@0 366
michael@0 367 <!-- the name from subtree, child inputs -->
michael@0 368 <span id="labelledby_mixed_input">
michael@0 369 <input type="button" id="input_button" title="input button"/>
michael@0 370 <input type="submit" id="input_submit"/>
michael@0 371 <input type="reset" id="input_reset"/>
michael@0 372 <input type="image" id="input_image" title="input image"/>
michael@0 373 </span>
michael@0 374 <button id="btn_labelledby_mixed_input"
michael@0 375 aria-labelledby="labelledby_mixed_input">7</button>
michael@0 376 <br/>
michael@0 377
michael@0 378 <!-- the name from subtree, child object -->
michael@0 379 <span id="labelledby_mixed_object">
michael@0 380 <object data="about:blank" title="object"></object>
michael@0 381 </span>
michael@0 382 <button id="btn_labelledby_mixed_object"
michael@0 383 aria-labelledby="labelledby_mixed_object">8</button>
michael@0 384 <br/>
michael@0 385
michael@0 386 <!-- the name from subtree, child br -->
michael@0 387 <span id="labelledby_mixed_br">text<br/>text</span>
michael@0 388 <button id="btn_labelledby_mixed_br"
michael@0 389 aria-labelledby="labelledby_mixed_br">9</button>
michael@0 390 <br/>
michael@0 391
michael@0 392 <!-- the name from subtree, name from label content rather than from its title
michael@0 393 attribute -->
michael@0 394 <label for="from_label_ignoretitle"
michael@0 395 title="Select your country of origin">Country:</label>
michael@0 396 <select id="from_label_ignoretitle">
michael@0 397 <option>Germany</option>
michael@0 398 <option>Russia</option>
michael@0 399 </select>
michael@0 400
michael@0 401 <!-- the name from subtree, name from html:p content rather than from its
michael@0 402 title attribute -->
michael@0 403 <p id="p_ignoretitle"
michael@0 404 title="Select your country of origin">Choose country from.</p>
michael@0 405 <select id="from_p_ignoretitle" aria-labelledby="p_ignoretitle">
michael@0 406 <option>Germany</option>
michael@0 407 <option>Russia</option>
michael@0 408 </select>
michael@0 409
michael@0 410 <!-- the name from subtree, name from html:input value rather than from its
michael@0 411 title attribute -->
michael@0 412 <p id="from_input_ignoretitle" aria-labelledby="input_ignoretitle">Country</p>
michael@0 413 <input id="input_ignoretitle"
michael@0 414 value="Custom country"
michael@0 415 title="Input your country of origin"/ >
michael@0 416
michael@0 417 <!-- name from subtree, surround control by spaces to not jamm the text -->
michael@0 418 <label id="insert_spaces_around_control">
michael@0 419 start<input value="value">end
michael@0 420 </label>
michael@0 421
michael@0 422 <!-- no name from subtree because it holds whitespaces only -->
michael@0 423 <a id="from_label_ignore_ws_subtree" href="about:" title="about">&nbsp;&nbsp; </a>
michael@0 424
michael@0 425 <!-- label element, label contains control -->
michael@0 426 <label>text<button id="btn_label_inside">10</button>text</label>
michael@0 427 <br/>
michael@0 428
michael@0 429 <!-- label element, label and the button are in the same form -->
michael@0 430 <form>
michael@0 431 <label for="btn_label_inform">in form</label>
michael@0 432 <button id="btn_label_inform">11</button>
michael@0 433 </form>
michael@0 434
michael@0 435 <!-- label element, label is outside of the form of the button -->
michael@0 436 <label for="btn_label_outform">out form</label>
michael@0 437 <form>
michael@0 438 <button id="btn_label_outform">12</button>
michael@0 439 </form>
michael@0 440
michael@0 441 <!-- label element, label and the button are in the same document -->
michael@0 442 <label for="btn_label_indocument">in document</label>
michael@0 443 <button id="btn_label_indocument">13</button>
michael@0 444
michael@0 445 <!-- multiple label elements for single button -->
michael@0 446 <label for="btn_label_multi">label1</label>
michael@0 447 <label for="btn_label_multi">label2</label>
michael@0 448 <button id="btn_label_multi">button</button>
michael@0 449
michael@0 450 <!-- name from children -->
michael@0 451 <span id="btn_children" role="button">14</span>
michael@0 452
michael@0 453 <!-- no name from content, ARIA role overrides this rule -->
michael@0 454 <button id="btn_nonamefromcontent" role="img">1</button>
michael@0 455
michael@0 456 <!-- name from children, hidden children -->
michael@0 457 <div role="listbox" tabindex="0">
michael@0 458 <div id="lb_opt1_children_hidden" role="option" tabindex="0">
michael@0 459 <span>i am visible</span>
michael@0 460 <span style="display:none">i am hidden</span>
michael@0 461 </div>
michael@0 462 </div>
michael@0 463
michael@0 464 <table role="menu">
michael@0 465 <tr role="menuitem" id="tablemenuitem">
michael@0 466 <td>menuitem 1</td>
michael@0 467 </tr>
michael@0 468 <tr role="menuitem">
michael@0 469 <td>menuitem 2</td>
michael@0 470 </tr>
michael@0 471 </table>
michael@0 472
michael@0 473 <label id="label_with_acronym">
michael@0 474 <acronym title="O A T F">OATF</acronym>
michael@0 475 <abbr title="World Wide Web">WWW</abbr>
michael@0 476 </label>
michael@0 477
michael@0 478 <div id="testArticle" role="article" title="Test article">
michael@0 479 <p>This is a paragraph inside the article.</p>
michael@0 480 </div>
michael@0 481
michael@0 482 <!-- name from title attribute -->
michael@0 483 <span id="btn_title" role="group" title="title">15</span>
michael@0 484
michael@0 485 <!-- A textarea nested in a label with a text child (bug #453371). -->
michael@0 486 <form>
michael@0 487 <label>Story
michael@0 488 <textarea id="textareawithchild" name="name">Foo</textarea>
michael@0 489 is ended.
michael@0 490 </label>
michael@0 491 </form>
michael@0 492
michael@0 493 <!-- controls having a value used as part of computed name -->
michael@0 494 <input type="checkbox" id="ctrlvalue_progressbar:input">
michael@0 495 <label for="ctrlvalue_progressbar:input">
michael@0 496 foo <span role="progressbar"
michael@0 497 aria-valuenow="5" aria-valuemin="1"
michael@0 498 aria-valuemax="10">5</span> baz
michael@0 499 </label>
michael@0 500
michael@0 501 <input type="checkbox" id="ctrlvalue_scrollbar:input" />
michael@0 502 <label for="ctrlvalue_scrollbar:input">
michael@0 503 foo <span role="scrollbar"
michael@0 504 aria-valuenow="5" aria-valuemin="1"
michael@0 505 aria-valuemax="10">5</span> baz
michael@0 506 </label>
michael@0 507
michael@0 508 <input type="checkbox" id="ctrlvalue_slider:input">
michael@0 509 <label for="ctrlvalue_slider:input">
michael@0 510 foo <input role="slider" type="range"
michael@0 511 value="5" min="1" max="10"
michael@0 512 aria-valuenow="5" aria-valuemin="1"
michael@0 513 aria-valuemax="10"> baz
michael@0 514 </label>
michael@0 515
michael@0 516 <input type="checkbox" id="ctrlvalue_spinbutton:input">
michael@0 517 <label for="ctrlvalue_spinbutton:input">
michael@0 518 foo <input role="spinbutton" type="number"
michael@0 519 value="5" min="1" max="10"
michael@0 520 aria-valuenow="5" aria-valuemin="1"
michael@0 521 aria-valuemax="10">
michael@0 522 baz
michael@0 523 </label>
michael@0 524
michael@0 525 <input type="checkbox" id="ctrlvalue_combobox:input">
michael@0 526 <label for="ctrlvalue_combobox:input">
michael@0 527 foo
michael@0 528 <div role="combobox">
michael@0 529 <div role="textbox"></div>
michael@0 530 <ul role="listbox" style="list-style-type: none;">
michael@0 531 <li role="option">1</li>
michael@0 532 <li role="option" aria-selected="true">5</li>
michael@0 533 <li role="option">3</li>
michael@0 534 </ul>
michael@0 535 </div>
michael@0 536 baz
michael@0 537 </label>
michael@0 538
michael@0 539 <!-- a label with a nested control in the start, middle and end -->
michael@0 540 <form>
michael@0 541 <!-- at the start (without and with whitespaces) -->
michael@0 542 <label id="comboinstart"><select id="combo3">
michael@0 543 <option>One</option>
michael@0 544 <option>Two</option>
michael@0 545 </select>
michael@0 546 day(s).
michael@0 547 </label>
michael@0 548
michael@0 549 <label id="textboxinstart">
michael@0 550 <input id="textbox1" value="Two">
michael@0 551 days.
michael@0 552 </label>
michael@0 553
michael@0 554 <!-- in the middle -->
michael@0 555 <label id="comboinmiddle">
michael@0 556 Subscribe to
michael@0 557 <select id="combo4" name="occupation">
michael@0 558 <option>ATOM</option>
michael@0 559 <option>RSS</option>
michael@0 560 </select>
michael@0 561 feed.
michael@0 562 </label>
michael@0 563
michael@0 564 <label id="comboinmiddle2" for="checkbox">Play the
michael@0 565 <select id="combo5">
michael@0 566 <option>Haliluya</option>
michael@0 567 <option>Hurra</option>
michael@0 568 </select>
michael@0 569 sound when new mail arrives
michael@0 570 </label>
michael@0 571 <input id="checkbox" type="checkbox" />
michael@0 572
michael@0 573 <label id="comboinmiddle3" for="combo6">Play the
michael@0 574 <select id="combo6">
michael@0 575 <option>Haliluya</option>
michael@0 576 <option>Hurra</option>
michael@0 577 </select>
michael@0 578 sound when new mail arrives
michael@0 579 </label>
michael@0 580
michael@0 581 <!-- at the end (without and with whitespaces) -->
michael@0 582 <label id="comboinend">
michael@0 583 This day was
michael@0 584 <select id="combo7" name="occupation">
michael@0 585 <option>sunny</option>
michael@0 586 <option>rainy</option>
michael@0 587 </select></label>
michael@0 588
michael@0 589 <label id="textboxinend">
michael@0 590 This day was
michael@0 591 <input id="textbox2" value="sunny">
michael@0 592 </label>
michael@0 593 </form>
michael@0 594
michael@0 595 <!-- placeholder -->
michael@0 596 <input id="ph_password" type="password" value="" placeholder="a placeholder" />
michael@0 597 <input id="ph_text" type="text" placeholder="a placeholder" />
michael@0 598 <textarea id="ph_textarea" cols="5" placeholder="a placeholder"></textarea>
michael@0 599
michael@0 600 <!-- placeholder does not win -->
michael@0 601 <input id="ph_text2" type="text" aria-label="a label" placeholder="meh" />
michael@0 602 <textarea id="ph_textarea2" cols="5" aria-labelledby="ph_text2"
michael@0 603 placeholder="meh"></textarea>
michael@0 604
michael@0 605 <label for="ph_text3">a label</label>
michael@0 606 <input id="ph_text3" placeholder="meh" />
michael@0 607
michael@0 608 <p>Image:
michael@0 609 <img id="img_eq" role="math" src="foo" alt="x^2 + y^2 + z^2">
michael@0 610 <input type="image" id="input_img_eq" src="foo" alt="x^2 + y^2 + z^2">
michael@0 611 </p>
michael@0 612
michael@0 613 <p>Text:
michael@0 614 <span id="txt_eq" role="math" title="x^2 + y^2 + z^2">x<sup>2</sup> +
michael@0 615 y<sup>2</sup> + z<sup>2</sup></span>
michael@0 616
michael@0 617 <!-- duplicate announcement -->
michael@0 618 <div id="test_note" role="note">subtree</div>
michael@0 619
michael@0 620 </body>
michael@0 621 </html>

mercurial