mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
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.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
c9d4913bb4
commit
0ce1571e71
Notes:
github-actions[bot]
2025-08-01 08:10:36 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/0ce1571e715 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5666
15
Tests/LibWeb/Text/input/selection-focuses-editing-host.html
Normal file
15
Tests/LibWeb/Text/input/selection-focuses-editing-host.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user