ladybird/Tests/LibWeb/Text/input/selection-focuses-editing-host.html
Jelle Raaijmakers 0ce1571e71 LibWeb: Selecting an editing host should focus it
Unspecced but common behavior in the major browsers: if the selection
moves to an editing host, the editing host itself should become focused.
2025-08-01 10:09:26 +02:00

15 lines
534 B
HTML

<!DOCTYPE html>
<div contenteditable>foo</div>
<script src="include.js"></script>
<script>
test(() => {
const divElm = document.querySelector('div[contenteditable]');
const range = document.createRange();
range.setStart(divElm.childNodes[0], 1);
range.setEnd(divElm.childNodes[0], 2);
window.getSelection().addRange(range);
println(`Range: ${range.startContainer} ${range.startOffset} ${range.endContainer} ${range.endOffset}`);
println(`document.activeElement: ${document.activeElement}`);
});
</script>