summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/focus/delegateFocus-is-focusable.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/mozilla/tests/focus/delegateFocus-is-focusable.html')
-rw-r--r--testing/web-platform/mozilla/tests/focus/delegateFocus-is-focusable.html19
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/mozilla/tests/focus/delegateFocus-is-focusable.html b/testing/web-platform/mozilla/tests/focus/delegateFocus-is-focusable.html
new file mode 100644
index 0000000000..35fd30f1f6
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/focus/delegateFocus-is-focusable.html
@@ -0,0 +1,19 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>focus move tests caused by a call of Selection.addRange()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="host"></div>
+<script>
+let host = document.getElementById("host");
+let shadow = host.attachShadow({ mode: "open", delegatesFocus: true });
+shadow.innerHTML = `<button>Focusable</button>`;
+
+test(function() {
+ assert_true(SpecialPowers.Services.focus.elementIsFocusable(host, 0), "host is focusable");
+ host.focus();
+ assert_equals(document.activeElement, host, "Host is focused");
+ assert_equals(shadow.activeElement, shadow.querySelector("button"), "Button is focused");
+ assert_true(SpecialPowers.Services.focus.elementIsFocusable(host, 0), "host is still focusable");
+}, "isElementFocusable with delegateFocus");
+</script>