Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

  • This test has a WPT meta file that expects 1 subtest issues.
  • This WPT test may be referenced by the following Test IDs:
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: focusgroup - Native contenteditable blocks directional exit</title>
<link rel="author" title="Microsoft" href="http://www.microsoft.com/">
<meta name="assert" content="A focused contenteditable blocks directional navigation out of the focusgroup.">
<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 id="toolbar" focusgroup="toolbar">
<button tabindex=0 id="btnBefore">Before</button>
<div id="target" contenteditable="true" tabindex="0">Editable</div>
<button tabindex=0 id="btnAfter">After</button>
</div>
<script>
const name = 'contenteditable';
// Directional navigation TO the directional-input element works.
promise_test(async t => {
await focusAndWait(btnBefore);
assert_equals(document.activeElement, btnBefore, 'Precondition: before button focused');
await focusAndSendDirectionalInput(btnBefore, kRight);
assert_equals(document.activeElement, target, `Right should navigate TO ${name}`);
}, `${name}: directional navigation TO element works`);
// Directional navigation FROM the directional-input element is blocked.
promise_test(async t => {
await focusAndWait(target);
assert_equals(document.activeElement, target, `Precondition: ${name} is focused`);
await assert_directional_input_does_not_move_focus(target);
}, `${name}: directional navigation FROM element is blocked`);
</script>