Closed datle-dev closed 4 months ago
One easy solution is to call event.preventDefault()
in the keydown event handler function. This has some implications on accessibility for keyboard-centric use or navigation of the page, but for now it solves the issue.
Another workaround discovered online was to add another event handler that would remove focus (i.e. blur) when a button is focused, which occurs when the button is pressed. For now, I've elected to not implement this, though it's an option to consider if more issues arise regarding this issue.
Expected Behavior
Pressing space at the completion of a word to move to the next (or in the middle of a word to skip to the next one) should move the cursor to the next word.
Actual Behavior
If you configure the test (timed vs. word mode, timed test duration or word test word count) by pressing a button, then immediately start typing, the test will proceed since the keydown event listener is active in the entire window. However, pressing space will instead repeat the last button press. Sometimes this throws off the cursor position because things aren't being reset correctly.
Steps to Reproduce the Problem