mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00:00
LibWeb: Do not invert the dispatch_event result in fire_keyboard_event
The return value of fire_keyboard_event is meant to indicate whether the event should continue propagating (true) or halt (false). This exactly matches the return value of dispatch_event, so by negating the result, we are propagating events we shouldn't, and not propagating events we should.
This commit is contained in:
parent
7edfeb7056
commit
27d40bafc9
1 changed files with 3 additions and 3 deletions
|
@ -712,16 +712,16 @@ bool EventHandler::fire_keyboard_event(FlyString const& event_name, HTML::Browsi
|
|||
}
|
||||
|
||||
auto event = UIEvents::KeyboardEvent::create_from_platform_event(document->realm(), event_name, key, modifiers, code_point);
|
||||
return !focused_element->dispatch_event(event);
|
||||
return focused_element->dispatch_event(event);
|
||||
}
|
||||
|
||||
// FIXME: De-duplicate this. This is just to prevent wasting a KeyboardEvent allocation when recursing into an (i)frame.
|
||||
auto event = UIEvents::KeyboardEvent::create_from_platform_event(document->realm(), event_name, key, modifiers, code_point);
|
||||
|
||||
if (JS::GCPtr<HTML::HTMLElement> body = document->body())
|
||||
return !body->dispatch_event(event);
|
||||
return body->dispatch_event(event);
|
||||
|
||||
return !document->root().dispatch_event(event);
|
||||
return document->root().dispatch_event(event);
|
||||
}
|
||||
|
||||
bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_point)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue