diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 26769cd652..abeece9e81 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -41,6 +41,14 @@ void HTMLInputElement::did_click_button(Badge) } } +void HTMLInputElement::did_click_checkbox(Badge) +{ + // FIXME: This should be a PointerEvent. + auto click_event = DOM::Event::create(EventNames::click); + click_event->set_bubbles(true); + dispatch_event(move(click_event)); +} + RefPtr HTMLInputElement::create_layout_node(NonnullRefPtr style) { if (type() == "hidden") diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index 2a96aceb66..2b1302affb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -43,6 +43,7 @@ public: bool enabled() const; void did_click_button(Badge); + void did_click_checkbox(Badge); void did_edit_text_node(Badge); diff --git a/Userland/Libraries/LibWeb/Layout/CheckBox.cpp b/Userland/Libraries/LibWeb/Layout/CheckBox.cpp index c171899834..8d1a3da589 100644 --- a/Userland/Libraries/LibWeb/Layout/CheckBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/CheckBox.cpp @@ -62,8 +62,10 @@ void CheckBox::handle_mouseup(Badge, const Gfx::IntPoint& position if (!is_inside_node_or_label) is_inside_node_or_label = Label::is_inside_associated_label(*this, position); - if (is_inside_node_or_label) + if (is_inside_node_or_label) { + dom_node().did_click_checkbox({}); dom_node().set_checked(!dom_node().checked(), HTML::HTMLInputElement::ChangeSource::User); + } m_being_pressed = false; m_tracking_mouse = false; @@ -103,6 +105,7 @@ void CheckBox::handle_associated_label_mouseup(Badge