mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
We were previously not allowing the user to select text when the clicked position represented a click-focusable area. This included text within dialogs (as the dialog element is click-focusable) and labels (as the associated input element would be considered click-focusable). We now no longer consider associated input elements when clicking on a label. This is handled separately already by the label's activation behavior steps, so there is no loss of functionality here. In those steps, though, we now no longer propagate the click event to the input element if a selection was made during the click. This matches the behavior of Firefox and Chrome. With label elements no longer considered here, we can then enter the character selection mode when click-focusable areas are clicked.
22 lines
509 B
HTML
22 lines
509 B
HTML
<!DOCTYPE html>
|
|
<script src="include.js"></script>
|
|
<dialog id="dialog" open>
|
|
<p id="text">This is a dialog</p>
|
|
</dialog>
|
|
<script>
|
|
test(() => {
|
|
let { x, y, width, height } = text.getBoundingClientRect();
|
|
x += width / 4;
|
|
y += height / 2;
|
|
|
|
internals.mouseDown(x, y);
|
|
|
|
x += width / 2;
|
|
internals.mouseMove(x, y);
|
|
internals.mouseUp(x, y);
|
|
|
|
println(`"${window.getSelection()}"`);
|
|
printElement(document.activeElement);
|
|
});
|
|
</script>
|