diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 1d3c4a2282..2a7b2c8f0c 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -348,7 +348,7 @@ void HTMLInputElement::did_edit_text_node(Badge)
});
}
-void HTMLInputElement::did_pick_color(Optional picked_color)
+void HTMLInputElement::did_pick_color(Optional picked_color, ColorPickerUpdateState state)
{
// https://html.spec.whatwg.org/multipage/input.html#common-input-element-events
// For input elements without a defined input activation behavior, but to which these events apply
@@ -371,14 +371,16 @@ void HTMLInputElement::did_pick_color(Optional picked_color)
});
// and any time the user commits the change, the user agent must queue an element task on the user interaction task source
- queue_an_element_task(HTML::Task::Source::UserInteraction, [this] {
- // given the input element
- // FIXME: to set its user interacted to true
- // and fire an event named change at the input element, with the bubbles attribute initialized to true.
- auto change_event = DOM::Event::create(realm(), HTML::EventNames::change);
- change_event->set_bubbles(true);
- dispatch_event(*change_event);
- });
+ if (state == ColorPickerUpdateState::Closed) {
+ queue_an_element_task(HTML::Task::Source::UserInteraction, [this] {
+ // given the input element
+ // FIXME: to set its user interacted to true
+ // and fire an event named change at the input element, with the bubbles attribute initialized to true.
+ auto change_event = DOM::Event::create(realm(), HTML::EventNames::change);
+ change_event->set_bubbles(true);
+ dispatch_event(*change_event);
+ });
+ }
}
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
index 3e62cb11ba..045c658988 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
@@ -11,6 +11,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -92,7 +93,7 @@ public:
bool is_mutable() const { return m_is_mutable; }
- void did_pick_color(Optional picked_color);
+ void did_pick_color(Optional picked_color, ColorPickerUpdateState state);
void did_select_files(Span selected_files);
diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp
index dfdce259f5..c5062703fc 100644
--- a/Userland/Libraries/LibWeb/Page/Page.cpp
+++ b/Userland/Libraries/LibWeb/Page/Page.cpp
@@ -337,7 +337,7 @@ void Page::color_picker_update(Optional picked_color, HTML::ColorPickerUp
if (m_pending_non_blocking_dialog_target) {
auto& input_element = verify_cast(*m_pending_non_blocking_dialog_target);
- input_element.did_pick_color(move(picked_color));
+ input_element.did_pick_color(move(picked_color), state);
if (state == HTML::ColorPickerUpdateState::Closed)
m_pending_non_blocking_dialog_target.clear();
}