Truly independent web browser
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="../expected/force-dark-leaves-image-map-focus-ring-alone-ref.html">
<style>
body { margin: 0; background: #000000; }
img { display: block; margin: 20px; }
</style>
<map name="m">
<area shape="poly" coords="20,20,180,20,100,80" href="#target" alt="target">
</map>
<img usemap="#m" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=" width="200" height="100" alt="image map">
<script>
// The image is fully transparent so force-dark has nothing to touch; the only thing painted is the user agent
// focus ring around the area, which has to keep its color rather than be treated like an author's border.
if (window.internals)
internals.setForceDarkEnabled(true);
// The focus ring is :focus-visible, which only keyboard focus earns, and it only paints while the window has
// focus; a headless run has to fake both, so the page is focused and Tab is pressed through internals.
if (window.internals) {
internals.setPageFocus(true);
internals.sendKey(document.body, "Tab");
}
requestAnimationFrame(() => {
requestAnimationFrame(() => {
document.documentElement.classList.remove("reftest-wait");
});
});
</script>
</html>