tabindex-focus-001.tentative.html (1314B)
1 <!DOCTYPE HTML> 2 <title>Invalid tabindex</title> 3 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1128054"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <!-- Test default focusability --> 8 <math></math> 9 <math href="#" data-focusable=true></math> 10 <!-- Test tabindex=0 focusability --> 11 <math tabindex="0" data-focusable=true></math> 12 <!-- Test tabindex=-1 focusability --> 13 <math tabindex="-1" data-focusable=true></math> 14 <!-- Test tabindex=invalid focusability --> 15 <math tabindex="invalid"></math> 16 <math href="#" tabindex="invalid" data-focusable=true></math> 17 18 <script> 19 test(() => { 20 for (let element of document.querySelectorAll("math")) { 21 let focusable = element.dataset && element.dataset.focusable; 22 let desc = "<math"; 23 for (let attr of ["href", "tabindex"]) { 24 if (element.hasAttribute(attr)) { 25 desc += ` ${attr}=${element.getAttribute(attr)}`; 26 } 27 } 28 desc += ">"; 29 element.focus(); 30 focusable ? assert_equals(document.activeElement, element, desc + " should be focusable") 31 : assert_not_equals(document.activeElement, element, desc + " should not be focusable"); 32 } 33 }, "invalid tabindex attribute does not make the element focusable"); 34 </script>