Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 4 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/interaction/focus/focusgroup/tentative/grid-navigation/simple-case-with-non-focusable-cell-in-the-center.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: focusgroup - Simple case with grid focusgroup, but with the cell R2C2 not focusable.</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>
<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>r2c2</td>
<td id=r2c3 tabindex=-1>r2c3</td>
</tr>
<tr>
<td id=r3c1 tabindex=-1>r3c1</td>
<td id=r3c2 tabindex=-1>r3c2</td>
<td id=r3c3 tabindex=-1>r3c3</td>
</tr>
</table>
<script>
promise_test(async t => {
var r2c1 = document.getElementById("r2c1");
var r2c3 = document.getElementById("r2c3");
await focusAndKeyPress(r2c1, kArrowRight);
assert_equals(document.activeElement, r2c3);
}, "A right arrow press should move the focus to the next column, skipping the non-focusable cell.");
promise_test(async t => {
var r1c2 = document.getElementById("r1c2");
var r3c2 = document.getElementById("r3c2");
await focusAndKeyPress(r1c2, kArrowDown);
assert_equals(document.activeElement, r3c2);
}, "A down arrow press should move the focus to the next row, skipping the non-focusable cell.");
promise_test(async t => {
var r2c1 = document.getElementById("r2c1");
var r2c3 = document.getElementById("r2c3");
await focusAndKeyPress(r2c3, kArrowLeft);
assert_equals(document.activeElement, r2c1);
}, "A left arrow press should move to the previous column, skipping the non-focusable cell.");
promise_test(async t => {
var r1c2 = document.getElementById("r1c2");
var r3c2 = document.getElementById("r3c2");
await focusAndKeyPress(r3c2, kArrowUp);
assert_equals(document.activeElement, r1c2);
}, "An up arrow press should move the focus to the previous row, skipping the non-focusable cell.");
</script>