| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title>HTML Test: focusgroup - Validate that flow allows both horizontal and vertical flowing.</title> |
| <link rel="author" title="Microsoft" href="http://www.microsoft.com/"> |
| <link rel="help" href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Focusgroup/explainer.md"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/resources/testdriver.js"></script> |
| <script src="/resources/testdriver-vendor.js"></script> |
| <script src="/resources/testdriver-actions.js"></script> |
| <script src="../resources/focusgroup-utils.js"></script> |
| |
| <table focusgroup="grid flow"> |
| <tr> |
| <td id=r1c1 tabindex=0>r1c1</td> |
| <td id=r1c2 tabindex=-1>r1c2</td> |
| <td id=r1c3 tabindex=-1>r1c3</td> |
| </tr> |
| <tr> |
| <td id=r2c1 tabindex=-1>r2c1</td> |
| <td id=r2c2 tabindex=-1>r2c2</td> |
| <td id=r2c3 tabindex=-1>r2c3</td> |
| </tr> |
| </table> |
| |
| <script> |
| |
| promise_test(async t => { |
| var r1c3 = document.getElementById("r1c3"); |
| var r2c1 = document.getElementById("r2c1"); |
| |
| await focusAndKeyPress(r1c3, kArrowRight); |
| assert_equals(document.activeElement, r2c1); |
| }, "When on the last column, a right arrow press should move the focus to first column and next row if the focusgroup flows horizontally."); |
| |
| promise_test(async t => { |
| var r1c2 = document.getElementById("r1c2"); |
| var r2c1 = document.getElementById("r2c1"); |
| |
| await focusAndKeyPress(r2c1, kArrowDown); |
| assert_equals(document.activeElement, r1c2); |
| }, "When on the last row, a down arrow press should move the focus to first row and next column if the focusgroup flows horizontally."); |
| |
| promise_test(async t => { |
| var r1c3 = document.getElementById("r1c3"); |
| var r2c1 = document.getElementById("r2c1"); |
| |
| await focusAndKeyPress(r2c1, kArrowLeft); |
| assert_equals(document.activeElement, r1c3); |
| }, "When on the first column, a left arrow press should move the focus to last column and previous row if the focusgroup flows horizontally."); |
| |
| promise_test(async t => { |
| var r1c1 = document.getElementById("r1c1"); |
| var r2c3 = document.getElementById("r2c3"); |
| |
| await focusAndKeyPress(r1c1, kArrowUp); |
| assert_equals(document.activeElement, r2c3); |
| }, "When on the first row, an up arrow press should move the focus to last row and previous column if the focusgroup flows horizontally."); |
| |
| </script> |