From b57199ccb9deb7b72eb75108404969665c669a5b Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 2 Jul 2023 22:18:47 -0700 Subject: [PATCH] Ladybird: Propagate "empty" key events to the WebContent process We currently drop events which do not have text associated with them. This prevents e.g. arrow keys from being able to be handled by web elements. We now match Browser's behavior on Serenity, where these key events are already propagated. --- Ladybird/WebContentView.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp index bd097a9250..c62f0c3f5c 100644 --- a/Ladybird/WebContentView.cpp +++ b/Ladybird/WebContentView.cpp @@ -369,10 +369,7 @@ void WebContentView::keyPressEvent(QKeyEvent* event) } auto text = event->text(); - if (text.isEmpty()) { - return; - } - auto point = event->text()[0].unicode(); + auto point = text.isEmpty() ? 0u : event->text()[0].unicode(); auto keycode = get_keycode_from_qt_keyboard_event(*event); auto modifiers = get_modifiers_from_qt_keyboard_event(*event); client().async_key_down(keycode, modifiers, point); @@ -381,10 +378,7 @@ void WebContentView::keyPressEvent(QKeyEvent* event) void WebContentView::keyReleaseEvent(QKeyEvent* event) { auto text = event->text(); - if (text.isEmpty()) { - return; - } - auto point = event->text()[0].unicode(); + auto point = text.isEmpty() ? 0u : event->text()[0].unicode(); auto keycode = get_keycode_from_qt_keyboard_event(*event); auto modifiers = get_modifiers_from_qt_keyboard_event(*event); client().async_key_up(keycode, modifiers, point);