Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement setSequentialFocusStartingPoint #42006

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="https://github.com/whatwg/html/issues/5326">
<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>

<button id=b1>b1</button>
<div id=d1>d1</div>
<button id=b2>b2</button>

<script>
const tabKey = '\uE004';
promise_test(async () => {
assert_equals(document.activeElement, document.body,
'Focus should initially be set on the body element.');

document.setSequentialFocusStartingPoint(d1);
assert_equals(document.activeElement, document.body,
'Calling setSequentialFocusStartingPoint should not change the focused element.');

await test_driver.send_keys(document.activeElement, tabKey);
assert_equals(document.activeElement, b2,
'Pressing tab should focus the next button after the sequential focus starting point.');
}, 'document.setSequentialFocusStartingPoint should set the sequential focus starting point on any element.');
</script>