tabindex-002.tentative.html (2376B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"/> 3 <title>MathML tabindex attribute</title> 4 <meta name="timeout" content="long"> 5 <link rel="help" href="https://w3c.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements"> 6 <meta assert="flag" content="interact"> 7 <meta assert="assert" content="Check the sequential focus navigation order for MathML"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/resources/testdriver.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <div id="log"></div> 13 <a href="#link">tabindex(html,href)</a> 14 <math> 15 <mtext id="text1">tabindex(omitted)</mtext> 16 <mtext id="text2" tabindex="">tabindex(empty)</mtext> 17 <mtext id="text3" tabindex="a">tabindex(a)</mtext> 18 <mtext id="text4" tabindex="-1">tabindex(-1)</mtext> 19 <mtext id="text5" tabindex="0">tabindex(0)</mtext> 20 <mtext id="text6" href="#link">tabindex(href)</mtext> 21 <mtext id="text7" tabindex="3">tabindex(3)</mtext> 22 <mtext id="text8" tabindex="2">tabindex(2)</mtext> 23 <mtext id="text9" tabindex="2">tabindex(2)</mtext> 24 <mtext id="text10" tabindex="2">tabindex(2)</mtext> 25 <mtext id="text11" tabindex="1">tabindex(1)</mtext> 26 </math> 27 <script> 28 29 var i = 0, 30 expectation = ["text11", "text8", "text9", "text10", "text7", "text5"], 31 results = [], 32 t = async_test("Elements with different tabindex must be focused sequentially when pressing 'Tab' keys"); 33 34 setup(function () { 35 document.body.focus(); 36 }); 37 38 document.querySelector("a").addEventListener("focus", function (evt) { 39 // Links are tab-navigable on that platform. 40 expectation.push("text6"); 41 // TAB = '\ue004' 42 test_driver.send_keys(document.body, "\ue004"); 43 }, true); 44 45 document.querySelector("math").addEventListener("focus", function (evt) { 46 results.push(evt.target.id); 47 i++; 48 if (i >= expectation.length) { 49 t.step(function () { 50 assert_array_equals(results, expectation); 51 }); 52 t.done(); 53 } else { 54 t.step(function () { 55 // TAB = '\ue004' 56 test_driver.send_keys(document.body, "\ue004"); 57 }); 58 } 59 }, true); 60 61 document.addEventListener("keydown", function (evt) { 62 t.step(function () { 63 assert_equals(evt.keyCode, 9, "Please press 'Tab' key."); 64 }); 65 }, true); 66 67 t.step(function () { 68 // TAB = '\ue004' 69 test_driver.send_keys(document.body, "\ue004"); 70 }); 71 </script>