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/forward-navigation/rtl-direction-reverses-inline.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: focusgroup - In RTL, Left moves focus forward inline.</title>
<meta name="assert" content="In an RTL focusgroup, the Left key should move focus forward (inline-end) and Right should move focus backward (inline-start), reversing the LTR default.">
<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="/shadow-dom/focus-navigation/resources/focus-utils.js"></script>
<script src="../resources/focusgroup-utils.js"></script>
<div dir="rtl" focusgroup="toolbar inline block">
<span id=item1 tabindex=0>item1</span>
<span id=item2 tabindex=0>item2</span>
<span id=item3 tabindex=0>item3</span>
</div>
<script>
promise_test(async t => {
var item1 = document.getElementById("item1");
var item2 = document.getElementById("item2");
// In RTL, Left is forward inline (towards inline-end).
await focusAndSendDirectionalInput(item1, kLeft);
assert_equals(document.activeElement, item2,
"Left should move forward inline in RTL");
}, "Left moves focus to the next item in an RTL focusgroup.");
promise_test(async t => {
var item1 = document.getElementById("item1");
var item2 = document.getElementById("item2");
// In RTL, Right is backward inline (towards inline-start).
await focusAndSendDirectionalInput(item2, kRight);
assert_equals(document.activeElement, item1,
"Right should move backward inline in RTL");
}, "Right moves focus to the previous item in an RTL focusgroup.");
promise_test(async t => {
var item1 = document.getElementById("item1");
var item2 = document.getElementById("item2");
// Down should still move forward (block axis is unaffected by RTL).
await focusAndSendDirectionalInput(item1, kDown);
assert_equals(document.activeElement, item2,
"Down should move forward block in RTL (unchanged)");
}, "Down moves focus forward in an RTL focusgroup (block axis unaffected).");
promise_test(async t => {
var item1 = document.getElementById("item1");
var item2 = document.getElementById("item2");
// Up should still move backward (block axis is unaffected by RTL).
await focusAndSendDirectionalInput(item2, kUp);
assert_equals(document.activeElement, item1,
"Up should move backward block in RTL (unchanged)");
}, "Up moves focus backward in an RTL focusgroup (block axis unaffected).");
</script>