mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
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.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
a055e36715
commit
7c9b3c08fa
Notes:
github-actions[bot]
2026-02-17 17:38:35 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/7c9b3c08faf Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8002 Reviewed-by: https://github.com/gmta ✅
20
Tests/LibWeb/Text/input/select-text-label.html
Normal file
20
Tests/LibWeb/Text/input/select-text-label.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user