1
0
Fork 0
firefox/testing/web-platform/tests/shadow-dom/focus/delegatesFocus-tabindex-change.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

23 lines
832 B
HTML

<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
test(() => {
const host = document.createElement('div');
document.body.appendChild(host);
const shadowRoot = host.attachShadow({mode: 'open', delegatesFocus: true});
const shadowInput = document.createElement('input');
shadowRoot.appendChild(shadowInput);
host.focus();
assert_equals(document.activeElement, host, 'The shadow host should be focused.');
host.setAttribute('tabindex', '0');
assert_equals(document.activeElement, host, 'The shadow host should remain focused after changing tabindex.');
}, 'Setting tabindex on the shadow host of a focused element with delegatesFocus should not change focus.');
</script>