diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html b/testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html new file mode 100644 index 0000000000000..386045258e043 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html @@ -0,0 +1,72 @@ + + + + + CSS Test (Selectors): :focus behavior with shadow hosts & delegatesFocus + + + + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/resources/shadow-utils.js b/testing/web-platform/tests/shadow-dom/focus/resources/shadow-utils.js index 6ea372afdf180..8033ce0169f4a 100644 --- a/testing/web-platform/tests/shadow-dom/focus/resources/shadow-utils.js +++ b/testing/web-platform/tests/shadow-dom/focus/resources/shadow-utils.js @@ -60,8 +60,9 @@ function removeTabIndex(elements) { } } -function resetFocus() { - document.body.focus(); +function resetFocus(root = document) { + if (root.activeElement) + root.activeElement.blur(); } function navigateFocusForward() {