row-flow-only.html (2236B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: focusgroup - Validate that row-flow allows only horizontal flowing.</title> 4 <link rel="author" title="Microsoft" href="http://www.microsoft.com/"> 5 <link rel="help" href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Focusgroup/explainer.md"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script src="/resources/testdriver-actions.js"></script> 11 <script src="../resources/focusgroup-utils.js"></script> 12 13 <table focusgroup="grid row-flow"> 14 <tr> 15 <td id=r1c1 tabindex=0>r1c1</td> 16 <td id=r1c2 tabindex=0>r1c2</td> 17 <td id=r1c3 tabindex=0>r1c3</td> 18 </tr> 19 <tr> 20 <td id=r2c1 tabindex=0>r2c1</td> 21 <td id=r2c2 tabindex=0>r2c2</td> 22 <td id=r2c3 tabindex=0>r2c3</td> 23 </tr> 24 </table> 25 26 <script> 27 28 promise_test(async t => { 29 var r1c3 = document.getElementById("r1c3"); 30 var r2c1 = document.getElementById("r2c1"); 31 32 await focusAndKeyPress(r1c3, kArrowRight); 33 assert_equals(document.activeElement, r2c1); 34 }, "When on the last column, a right arrow press should move the focus to first column and next row if the focusgroup flows horizontally."); 35 36 promise_test(async t => { 37 var r2c1 = document.getElementById("r2c1"); 38 39 await focusAndKeyPress(r2c1, kArrowDown); 40 assert_equals(document.activeElement, r2c1); 41 }, "A down arrow press should not flow the focus vertically when not supported by the focusgroup."); 42 43 promise_test(async t => { 44 var r1c3 = document.getElementById("r1c3"); 45 var r2c1 = document.getElementById("r2c1"); 46 47 await focusAndKeyPress(r2c1, kArrowLeft); 48 assert_equals(document.activeElement, r1c3); 49 }, "When on the first column, a left arrow press should move the focus to last column and previous row if the focusgroup flows horizontally."); 50 51 promise_test(async t => { 52 var r1c1 = document.getElementById("r1c1"); 53 54 await focusAndKeyPress(r1c1, kArrowUp); 55 assert_equals(document.activeElement, r1c1); 56 }, "An up arrow press should not flow the focus vertically when not supported by the focusgroup."); 57 58 </script>