Firefox skips key events
I'm on Arch Linux and use uinput to create key events. It works reliably for >12months in all applications and under all circumstances except in Firefox where some key events are skipped non-deterministically. My test case is:
in a text field, emit `<ctrl down>a<ctrl up>
123456789987654321<left>...<left>` with 9 times `<left>`. Sometimes a 9 is missing and sometimes the cursor is further to the right than expected.
This happens every 8th try or so, which is too frequent to not break the user experience.
What I have tried: - multiple PCs (2 with this issue and 1 without) - Troubleshoot Mode - `window.onkeydown=(e)=>console.log(e)` (events are missing)
Since I've only ever seen repeated characters/keys disappear and never when writing manually, I would guess there is some kind of event cleanup algorithm kicking in. (the events are emitted without any delays)
I would really like to fix this issue because Firefox is my favorite browser. Any idea how to track it down?
Maybe related: https://support.mozilla.org/en-US/questions/1363234
All Replies (3)
after `<ctrl up>` there is a `<d e l>`
X11 or Wayland? Does setting the environment variable MOZ_ENABLE_WAYLAND=1 make any difference?
This is a good site for testing: https://w3c.github.io/uievents/tools/key-event-viewer.html
Thanks for the reply! Its Wayland and MOZ_ENABLE_WAYLAND=1 doesn't.
The event viewer showed that keydown are missing (two keyup back to back). I've did some more testing:
- if JS is idle, I can't reproduce - if JS is busy, it happens ever so often (I created a minimal page with a busy loop on "input" of the input element) - it really only affects consecutive events of the same key. For instance, emitting 12121212112121212121 only hicks up exactly at 11 (one of them ends up missing)
Btw, can't reproduce in Chrome