| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML> | |
| 2 <html> | |
| 3 <body> | |
| 4 <script src="../fast/js/resources/js-test-pre.js"></script> | |
| 5 | |
| 6 <style> | |
| 7 #form2 legend {position:absolute; left:-9999px;} | |
| 8 #form3 legend {display:none;} | |
| 9 </style> | |
| 10 | |
| 11 <form action="#" method="post" id="form1"> | |
| 12 <fieldset tabindex=0 role="group" id="fieldset1"> | |
| 13 <legend>Pick your favourite colour:</legend> | |
| 14 <input type="radio" name="colours3" value="red3" id="red3"> <label for="red3">re
d</label> | |
| 15 <input type="radio" name="colours3" value="yellow3" id="yellow3"> <label for="ye
llow3">yellow</label> | |
| 16 </fieldset> | |
| 17 </form> | |
| 18 | |
| 19 <form action="#" method="post" id="form2"> | |
| 20 <fieldset tabindex=0 role="group" id="fieldset2"> | |
| 21 <legend>Pick your favourite colour:</legend> | |
| 22 <input type="radio" name="colours3" value="red3" id="red3"> <label for="red3">re
d</label> | |
| 23 <input type="radio" name="colours3" value="yellow3" id="yellow3"> <label for="ye
llow3">yellow</label> | |
| 24 </fieldset> | |
| 25 </form> | |
| 26 | |
| 27 <form action="#" method="post" id="form3"> | |
| 28 <fieldset tabindex=0 role="group" id="fieldset3"> | |
| 29 <legend>Pick your favourite colour:</legend> | |
| 30 <input type="radio" name="colours3" value="red3" id="red3"> <label for="red3">re
d</label> | |
| 31 <input type="radio" name="colours3" value="yellow3" id="yellow3"> <label for="ye
llow3">yellow</label> | |
| 32 </fieldset> | |
| 33 </form> | |
| 34 | |
| 35 <div id="console"></div> | |
| 36 <script> | |
| 37 description("This tests that the legend is still used as the title UI element ev
en when off-screen (but not when display:none is used)") | |
| 38 | |
| 39 if (window.testRunner && window.accessibilityController) { | |
| 40 | |
| 41 // 1st case: testing when a fieldset uses an unmodified legend. The title UI
element | |
| 42 // should be the legend (which is the first child). | |
| 43 document.getElementById('fieldset1').focus(); | |
| 44 var fieldset1 = accessibilityController.focusedElement; | |
| 45 shouldBeTrue("fieldset1.titleUIElement().isEqual(fieldset1.childAtIndex(0))"
); | |
| 46 | |
| 47 // 2nd case: a hidden legend should still be the title UI element. | |
| 48 document.getElementById('fieldset2').focus(); | |
| 49 var fieldset2 = accessibilityController.focusedElement; | |
| 50 shouldBeTrue("fieldset2.titleUIElement().isEqual(fieldset2.childAtIndex(0))"
); | |
| 51 | |
| 52 // 3rd case: a legend with display:none should not be a title UI element. | |
| 53 document.getElementById('fieldset3').focus(); | |
| 54 var fieldset3 = accessibilityController.focusedElement; | |
| 55 shouldBeTrue("fieldset3.titleUIElement() == null || !fieldset3.titleUIElemen
t().isValid"); | |
| 56 } | |
| 57 | |
| 58 </script> | |
| 59 | |
| 60 <script src="../fast/js/resources/js-test-post.js"></script> | |
| 61 </body> | |
| 62 </html> | |
| OLD | NEW |