Skip to content

Commit

Permalink
css/css-contain/content-visibility/content-visibility-068.html
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mrobinson authored and pull[bot] committed Nov 28, 2023
1 parent c04bcb6 commit 2d139b4
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
}
</style>

<div id=end tabindex=1></div>
<div class=spacer></div>
<div id=container>
<div id=focusable tabindex=0></div>
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2d139b4

Please sign in to comment.