mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb/EventHandler: Ignore repeated keyup events
Platforms such as X11 will typically send repeated keyRelease/keyup events as a result of auto-repeating: * KeyPress (initial) * KeyRelease (repeat) * KeyPress (repeat) * KeyRelease (repeat) * ad infinitum Make our EventHandler more spec-compliant by ignoring all repeated keyup events. This fixes long-pressing the arrow keys on https://playbiolab.com/.
This commit is contained in:
parent
9309cc9df3
commit
77850b3540
|
|
@ -1171,8 +1171,13 @@ EventResult EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u
|
|||
return EventResult::Accepted;
|
||||
}
|
||||
|
||||
EventResult EventHandler::handle_keyup(UIEvents::KeyCode key, u32 modifiers, u32 code_point, [[maybe_unused]] bool repeat)
|
||||
EventResult EventHandler::handle_keyup(UIEvents::KeyCode key, u32 modifiers, u32 code_point, bool repeat)
|
||||
{
|
||||
// Keyup events as a result of auto-repeat are not fired.
|
||||
// See: https://w3c.github.io/uievents/#events-keyboard-event-order
|
||||
if (repeat)
|
||||
return EventResult::Dropped;
|
||||
|
||||
return fire_keyboard_event(UIEvents::EventNames::keyup, m_navigable, key, modifiers, code_point, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user