LibWeb/HTML: Correctly reset selection on type change

The selection now gets reset to the beginning of the control if the
type changes from an unselectable type to a selectable type.
This commit is contained in:
Glenn Skrzypczak 2025-04-20 19:43:37 +02:00 committed by Tim Ledbetter
parent 84e29f791c
commit 5f75558646
Notes: github-actions[bot] 2025-04-23 06:21:13 +00:00
3 changed files with 552 additions and 0 deletions

View file

@ -1470,6 +1470,7 @@ void HTMLInputElement::type_attribute_changed(TypeAttributeState old_state, Type
// 9. If previouslySelectable is false and nowSelectable is true, set the element's text entry cursor position to the
// beginning of the text control, and set its selection direction to "none".
if (!previously_selectable && now_selectable) {
set_the_selection_range(0, 0);
set_selection_direction(OptionalNone {});
}
}