Bug 1586425 [wpt PR 19530] - Fix shadow-dom/focus/focus-selector-delegatesFocus.html for slotted elements, a=testonly
authorRyosuke Niwa <rniwa@webkit.org>
Mon, 14 Oct 2019 13:37:26 +0000
changeset 559528 cc71a8e1bfa75d3b5585812059f9fe6195dd598c
parent 559527 a504da5117372ee8327022e6c26e64fa32bfca75
child 559529 120f1820f797832dccabd11523f33bc715043f57
push id12177
push usercsabou@mozilla.com
push dateMon, 21 Oct 2019 14:52:16 +0000
treeherdermozilla-beta@1918a9cd33bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1586425, 19530
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1586425 [wpt PR 19530] - Fix shadow-dom/focus/focus-selector-delegatesFocus.html for slotted elements, a=testonly Automatic update from web-platform-tests Fix shadow-dom/focus/focus-selector-delegatesFocus.html for slotted elements As specified in https://html.spec.whatwg.org/multipage/semantics-other.html#element-has-the-focus, an element has focus when itself is in the focus chain or its shadow root contains the focused element. Since the shadow tree does not contain a slotted element, its shadow host should not match :focus pseudo class. Otherwise, the shadow host's tree would end up containing more than one element which match :focus, for example, the shadow host and its direct child which is actually focused. -- wpt-commits: 080acb0967ec06504808de9a25f64290df3d6128 wpt-pr: 19530
testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html
--- a/testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html
+++ b/testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html
@@ -46,18 +46,18 @@ for (const delegatesFocus of delegatesFo
     resetFocus();
     const host = createShadowHost(delegatesFocus, document.body);
     const slotted = createFocusableDiv();
     host.shadowRoot.appendChild(document.createElement("slot"));
     host.appendChild(slotted);
 
     slotted.focus();
     assert_true(slotted.matches(":focus"), "slotted element matches :focus");
-    assert_true(host.matches(":focus"), "host matches :focus");
-  }, `:focus applies to host with delegatesFocus=${delegatesFocus} when slotted element has focus`);
+    assert_false(host.matches(":focus"), "host matches :focus");
+  }, `:focus does not apply to host with delegatesFocus=${delegatesFocus} when slotted element has focus`);
 
   for (const nestedDelegatesFocus of delegatesFocusValues) {
     test(() => {
       resetFocus();
       const host = createShadowHost(delegatesFocus, document.body);
       const nestedHost = createShadowHost(nestedDelegatesFocus, host.shadowRoot);
       const nestedShadowChild = createFocusableDiv();
       nestedHost.shadowRoot.appendChild(nestedShadowChild);