css/css-contain/content-visibility/content-visibility-068.html
Fix a WPT test relating to `content-visibility: auto` and
content-relevancy. This test attempts to change the relevancy of content
by blurring it, but relevancy also depends on selection. Apparently,
Gecko differs from other browsers in that `blur()` is not moving the
selection as well. The fix is to simply focus another element which will
update both focus and the text selection.
Differential Revision: https://phabricator.services.mozilla.com/D163706
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1797447
gecko-commit: 978147969b8ee70daa1920402b6ad2bc938207ee
gecko-reviewers: emilio
diff --git a/css/css-contain/content-visibility/content-visibility-068.html b/css/css-contain/content-visibility/content-visibility-068.html
index 330256a..90762f3 100644
--- a/css/css-contain/content-visibility/content-visibility-068.html
+++ b/css/css-contain/content-visibility/content-visibility-068.html
@@ -30,6 +30,7 @@
}
</style>
+<div id=end tabindex=1></div>
<div class=spacer></div>
<div id=container>
<div id=focusable tabindex=0></div>
@@ -79,7 +80,11 @@
assert_equals(r.y, 3000, "step4 offset");
assert_equals(r.height, 10, "step4 height");
});
- focusable.blur();
+
+ // We don't use `blur()` here because in Gecko this leaves the selection
+ // on _focusable_ which means that its content is still relevant. Focusing
+ // another element will move both focus and selection.
+ end.focus();
requestAnimationFrame(step5);
}
// After blurring the focused element, we should go back to the contained