Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 2 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/interaction/focus/focusgroup/tentative/grid-navigation/moves-across-table-sections.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: focusgroup - Table with one or less row per section (head, 2 bodies and foot).</title>
<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 wrap">
<thead>
<tr>
<td id=r1c1 tabindex=0>r1c1</td>
</tr>
<tr>
<td id=r2c1 tabindex=-1>r2c1</td>
</tr>
</thead>
<tbody>
<tr>
<td id=r3c1 tabindex=-1>r3c1</td>
</tr>
<tr>
<td id=r4c1 tabindex=-1>r4c1</td>
</tr>
</tbody>
<tbody></tbody>
<tfoot>
<tr>
<td id=r5c1 tabindex=-1>r5c1</td>
</tr>
<tr>
<td id=r6c1 tabindex=-1>r6c1</td>
</tr>
</foot>
</table>
<script>
promise_test(async t => {
var r1c1 = document.getElementById("r1c1");
var r1c2 = document.getElementById("r2c1");
var r3c2 = document.getElementById("r3c1");
var r4c2 = document.getElementById("r4c1");
var r5c2 = document.getElementById("r5c1");
var r6c2 = document.getElementById("r6c1");
await focusAndKeyPress(r1c1, kArrowDown);
assert_equals(document.activeElement, r2c1);
await focusAndKeyPress(r2c1, kArrowDown);
assert_equals(document.activeElement, r3c1);
await focusAndKeyPress(r3c1, kArrowDown);
assert_equals(document.activeElement, r4c1);
await focusAndKeyPress(r4c1, kArrowDown);
assert_equals(document.activeElement, r5c1);
await focusAndKeyPress(r5c1, kArrowDown);
assert_equals(document.activeElement, r6c1);
await focusAndKeyPress(r6c1, kArrowDown);
assert_equals(document.activeElement, r1c1);
}, "A down arrow press should move the focus to the next row even when that row is in another section.");
promise_test(async t => {
var r1c1 = document.getElementById("r1c1");
var r1c2 = document.getElementById("r2c1");
var r3c2 = document.getElementById("r3c1");
var r4c2 = document.getElementById("r4c1");
var r5c2 = document.getElementById("r5c1");
var r6c2 = document.getElementById("r6c1");
await focusAndKeyPress(r6c1, kArrowUp);
assert_equals(document.activeElement, r5c1);
await focusAndKeyPress(r5c1, kArrowUp);
assert_equals(document.activeElement, r4c1);
await focusAndKeyPress(r4c1, kArrowUp);
assert_equals(document.activeElement, r3c1);
await focusAndKeyPress(r3c1, kArrowUp);
assert_equals(document.activeElement, r2c1);
await focusAndKeyPress(r2c1, kArrowUp);
assert_equals(document.activeElement, r1c1);
await focusAndKeyPress(r1c1, kArrowUp);
assert_equals(document.activeElement, r6c1);
}, "An up arrow press should move the focus to the previous row even when that row is in another section.");
</script>