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/behavior-tokens/menubar.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: focusgroup - menubar behavior token defaults</title>
<meta name="assert" content="menubar implies inline axis, wrap.">
<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 focusgroup="menubar">
<button tabindex=0 id=mb1>mb1</button>
<button tabindex=0 id=mb2>mb2</button>
<button tabindex=0 id=mb3>mb3</button>
</div>
<script>
promise_test(async t => {
await focusAndSendDirectionalInput(document.getElementById('mb1'), kRight);
assert_equals(document.activeElement.id, 'mb2');
}, "menubar: Right navigates to the next item");
promise_test(async t => {
await focusAndSendDirectionalInput(document.getElementById('mb2'), kLeft);
assert_equals(document.activeElement.id, 'mb1');
}, "menubar: Left navigates to the previous item");
promise_test(async t => {
await focusAndSendDirectionalInput(document.getElementById('mb1'), kDown);
assert_equals(document.activeElement.id, 'mb1');
}, "menubar: Down blocked");
promise_test(async t => {
await focusAndSendDirectionalInput(document.getElementById('mb1'), kUp);
assert_equals(document.activeElement.id, 'mb1');
}, "menubar: Up blocked");
promise_test(async t => {
await focusAndSendDirectionalInput(document.getElementById('mb3'), kRight);
assert_equals(document.activeElement.id, 'mb1');
}, "menubar: Right wraps at end");
promise_test(async t => {
await focusAndSendDirectionalInput(document.getElementById('mb1'), kLeft);
assert_equals(document.activeElement.id, 'mb3');
}, "menubar: Left wraps at start");
</script>