LibWeb: Look for labeled control in DOM tree instead of layout tree

...because "change" event should be dispatched on control even if it
has "display: none" style.

This change fixes selection in labels dropdown on GitHub's "new issue"
page.
This commit is contained in:
Aliaksandr Kalenik 2024-03-23 12:03:21 +01:00 committed by Andreas Kling
commit f932d5d825
Notes: sideshowbarker 2024-07-17 07:11:12 +09:00
8 changed files with 74 additions and 49 deletions

View file

@ -30,10 +30,8 @@ bool TextPaintable::wants_mouse_events() const
DOM::Node* TextPaintable::mouse_event_target() const
{
if (auto* label = layout_node().first_ancestor_of_type<Layout::Label>()) {
if (auto* control = const_cast<Layout::Label*>(label)->labeled_control())
return &control->dom_node();
}
if (auto const* label = layout_node().first_ancestor_of_type<Layout::Label>())
return label->dom_node().control().ptr();
return nullptr;
}