1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:37:34 +00:00

LibWeb: Make <input type=checkbox> fire click events when clicked :^)

This makes React react to checkboxes. Apparently they ignore the
"change" event in favor of "click" on checkboxes. This is a
compatibility hack for IE8.
This commit is contained in:
Andreas Kling 2022-02-17 13:31:09 +01:00
parent 2660795bcf
commit 246c31ccf6
3 changed files with 13 additions and 1 deletions

View file

@ -41,6 +41,14 @@ void HTMLInputElement::did_click_button(Badge<Layout::ButtonBox>)
}
}
void HTMLInputElement::did_click_checkbox(Badge<Layout::CheckBox>)
{
// 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<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
if (type() == "hidden")

View file

@ -43,6 +43,7 @@ public:
bool enabled() const;
void did_click_button(Badge<Layout::ButtonBox>);
void did_click_checkbox(Badge<Layout::CheckBox>);
void did_edit_text_node(Badge<BrowsingContext>);