Files
ladybird/Tests/LibWeb/Text/input/UIEvents/pointer-events-shadow-dom.html
Zaggy1024 1236565afd LibWeb: Include shadow host when checking for node event listeners
Fixes a regression in 57c9bb5 where the media controls would not show
when moving the cursor over the video overlay element.
2026-03-12 03:11:02 +01:00

58 lines
1.3 KiB
HTML

<!DOCTYPE html>
<style>
body {
margin: 0;
padding: 5px;
width: 200px;
height: 200px;
}
#host {
width: 100px;
height: 100px;
background-color: yellowgreen;
}
</style>
<body id="body"><div id="host"></div></body>
<script src="../include.js"></script>
<script>
test(() => {
const shadow = host.attachShadow({ mode: "open" });
shadow.innerHTML = `
<style>
#inner {
width: 50px;
height: 50px;
background-color: magenta;
}
</style>
<div id="inner"></div>
`;
const inner = shadow.getElementById("inner");
function logEvent(e) {
println(`${e.type} target.id="${e.target.id}" relatedTarget.id="${e.relatedTarget?.id ?? 'null'}"`);
}
internals.mouseMove(0, 0);
const events = [
'pointerover',
'pointerout',
'pointerenter',
'pointerleave',
'pointermove',
];
events.forEach(eventType => {
host.addEventListener(eventType, logEvent);
});
println("> move pointer over shadow content");
internals.mouseMove(10, 10);
println("> move pointer outside");
internals.mouseMove(0, 0);
});
</script>