From b4b947c60797328d930c8d3de466b8ef292d0ed4 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Wed, 22 May 2024 21:36:30 +0100 Subject: [PATCH] LibWeb: Update number input on mousedown of number input buttons This matches the behavior of other browsers. Previously, a click event was used, so the value was only updated when the mouse was released. --- Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index b83c9af38b5..4ddf49914b7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -845,7 +845,7 @@ void HTMLInputElement::create_text_input_shadow_tree() }, 0, "", &realm()); auto up_callback = realm().heap().allocate_without_realm(*up_callback_function, Bindings::host_defined_environment_settings_object(realm())); - up_button->add_event_listener_without_options(UIEvents::EventNames::click, DOM::IDLEventListener::create(realm(), up_callback)); + up_button->add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), up_callback)); // Down button auto down_button = MUST(DOM::create_element(document(), HTML::TagNames::button, Namespace::HTML)); @@ -864,7 +864,7 @@ void HTMLInputElement::create_text_input_shadow_tree() }, 0, "", &realm()); auto down_callback = realm().heap().allocate_without_realm(*down_callback_function, Bindings::host_defined_environment_settings_object(realm())); - down_button->add_event_listener_without_options(UIEvents::EventNames::click, DOM::IDLEventListener::create(realm(), down_callback)); + down_button->add_event_listener_without_options(UIEvents::EventNames::mousedown, DOM::IDLEventListener::create(realm(), down_callback)); } }