ruffle
ruffle copied to clipboard
core: Always fire `KeyPress` after `KeyDown` for buttons
Just fixing a bug I found when writing some tests.
Button events are actually handled twofold:
-
KeyPress
for printable characters is handled onTextInput
, -
KeyPress
for special characters (e.g. enter, arrows) is handled onKeyDown
.
Before this patch, KeyPress
was fired too early, so that for special characters (2) it fired BEFORE KeyDown
. This was not a problem for printable characters, as they fired on TextInput
, which always fired separately after KeyDown
.
This patch ensures that KeyPress
is fired always in the proper order.
Additionally I added a test that verifies the "KeyPress events take precedence over text input" behavior, because it was not covered by tests before.