mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-15 13:31:54 +00:00
LibWeb: Don't double-dispatch click events on a label's child input
If the user clicked directly on the input inside a label, then it already received a click event. Dispatching a second one via the label is redundant, and means that if the input is a checkbox, it gets its value toggled twice.
This commit is contained in:
parent
81d4ed27d8
commit
c00c0846c0
Notes:
github-actions[bot]
2025-04-15 11:35:28 +00:00
Author: https://github.com/AtkinsSJ
Commit: c00c0846c0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4366
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 54 additions and 1 deletions
|
@ -555,7 +555,7 @@ EventResult EventHandler::handle_mouseup(CSSPixelPoint viewport_position, CSSPix
|
|||
}
|
||||
|
||||
if (auto* input_control = input_control_associated_with_ancestor_label_element(*paintable)) {
|
||||
if (button == UIEvents::MouseButton::Primary) {
|
||||
if (button == UIEvents::MouseButton::Primary && input_control != node) {
|
||||
input_control->dispatch_event(UIEvents::MouseEvent::create_from_platform_event(node->realm(), UIEvents::EventNames::click, screen_position, page_offset, viewport_position, offset, {}, button, buttons, modifiers).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue