col-wrap-and-row-flow.html (2366B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: focusgroup - Validate that we can col-wrap AND row-flow.</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 col-wrap 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 r1c1 = document.getElementById("r1c1"); 38 var r2c1 = document.getElementById("r2c1"); 39 40 await focusAndKeyPress(r2c1, kArrowDown); 41 assert_equals(document.activeElement, r1c1); 42 }, "When on the last row, a down arrow press should move the focus to first row if the focusgroup wraps vertically."); 43 44 promise_test(async t => { 45 var r1c3 = document.getElementById("r1c3"); 46 var r2c1 = document.getElementById("r2c1"); 47 48 await focusAndKeyPress(r2c1, kArrowLeft); 49 assert_equals(document.activeElement, r1c3); 50 }, "When on the first column, a left arrow press should move the focus to last column and previous row if the focusgroup flows horizontally."); 51 52 promise_test(async t => { 53 var r1c1 = document.getElementById("r1c1"); 54 var r2c1 = document.getElementById("r2c1"); 55 56 await focusAndKeyPress(r1c1, kArrowUp); 57 assert_equals(document.activeElement, r2c1); 58 }, "When on the first row, an up arrow press should move the focus to last row if the focusgroup wraps vertically."); 59 60 </script>