From 27d40bafc9d8c035710390dec4a7bbbb8801a51b Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 30 Nov 2023 15:40:06 -0500 Subject: [PATCH] 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. --- Userland/Libraries/LibWeb/Page/EventHandler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index 87596dff91..f604d35c22 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -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 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)