test_focus_controls.html (2340B)
1 <html> 2 3 <head> 4 <title>Accessible focus testing on HTML controls</title> 5 6 <link rel="stylesheet" type="text/css" 7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 8 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 10 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 11 12 <script type="application/javascript" 13 src="../common.js"></script> 14 <script type="application/javascript" 15 src="../events.js"></script> 16 <script type="application/javascript" 17 src="../role.js"></script> 18 <script type="application/javascript" 19 src="../states.js"></script> 20 21 <script type="application/javascript"> 22 // gA11yEventDumpToConsole = true; 23 24 var gQueue = null; 25 function doTests() { 26 gQueue = new eventQueue(EVENT_FOCUS); 27 28 gQueue.push(new synthFocus("textbox")); 29 gQueue.push(new synthFocus("textarea")); 30 gQueue.push(new synthFocus("button1")); 31 gQueue.push(new synthFocus("button2")); 32 gQueue.push(new synthFocus("checkbox")); 33 gQueue.push(new synthFocus("radio1")); 34 gQueue.push(new synthDownKey("radio1", new focusChecker("radio2"))); 35 36 // no focus events for checkbox or radio inputs when they are checked 37 // programmatically 38 gQueue.push(new changeCurrentItem("checkbox")); 39 gQueue.push(new changeCurrentItem("radio1")); 40 41 let fileBrowseButton = getAccessible("file"); 42 gQueue.push(new synthFocus("file", new focusChecker(fileBrowseButton))); 43 44 gQueue.invoke(); // Will call SimpleTest.finish(); 45 } 46 47 SimpleTest.waitForExplicitFinish(); 48 addA11yLoadEvent(doTests); 49 </script> 50 </head> 51 52 <body> 53 54 <a target="_blank" 55 href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958" 56 title="Rework accessible focus handling"> 57 Mozilla Bug 673958 58 </a> 59 <p id="display"></p> 60 <div id="content" style="display: none"></div> 61 <pre id="test"> 62 </pre> 63 64 <input id="textbox"> 65 <textarea id="textarea"></textarea> 66 67 <input id="button1" type="button" value="button"> 68 <button id="button2">button</button> 69 <input id="checkbox" type="checkbox"> 70 <input id="radio1" type="radio" name="radiogroup"> 71 <input id="radio2" type="radio" name="radiogroup"> 72 <input id="file" type="file"> 73 74 <div id="eventdump"></div> 75 </body> 76 </html>