1 <p>This tests that option-tab moves you from a text field to a link, but plain old tab does not.</p>
2 <p>Note: Option is the Mac name for what other platforms call Alt.</p>
3 <input id="textField" type=text> <a onfocus="window.linkFocused = true" href="http://www.apple.com">link</a>
4 <input id="searchField" type=search> <a onfocus="window.linkFocused = true" href="http://www.apple.com">link</a>
10 testRunner.dumpAsText();
12 function test(fieldId)
14 window.linkFocused = false;
15 document.getElementById(fieldId).focus();
16 var event = document.createEvent("KeyboardEvents");
17 event.initKeyboardEvent("keydown", true, true, document.defaultView, "U+0009", 0, false, true, false, false, false);
18 document.getElementById(fieldId).dispatchEvent(event);
19 if (window.linkFocused)
20 document.getElementById("console").innerHTML += "SUCCESS: Option-tab did tab to the link (" + fieldId + ").\n";
22 document.getElementById("console").innerHTML += "FAIL: Option-tab did not tab to the link (" + fieldId + ").\n";
24 window.linkFocused = false;
25 document.getElementById(fieldId).focus();
26 event = document.createEvent("KeyboardEvents");
27 event.initKeyboardEvent("keydown", true, true, document.defaultView, "U+0009", 0, false, false, false, false, false);
28 document.getElementById(fieldId).dispatchEvent(event);
29 if (window.linkFocused)
30 document.getElementById("console").innerHTML += "FAIL: Plain old tab did tab to the link (" + fieldId + ").\n";
32 document.getElementById("console").innerHTML += "SUCCESS: Plain old tab did not tab to the link (" + fieldId + ").\n";