Files
ladybird/Tests/LibWeb/Text/input/select-text-label.html
Timothy Flynn 7c9b3c08fa LibWeb: Allow selecting text in dialog and label elements
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.
2026-02-17 18:36:54 +01:00

21 lines
536 B
HTML

<!DOCTYPE html>
<script src="include.js"></script>
<label for="input" id="label">This is a label</label>
<input id="input" value="This is an input" />
<script>
test(() => {
let { x, y, width, height } = label.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>