mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00: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
Notes:
github-actions[bot]
2024-10-22 15:21:30 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/77850b35402 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1913 Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 6 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue