wdudek82 / touchytyper-fronend-react

Application to practice touch typing (Frontend in React)
0 stars 0 forks source link

Enable key event blocking #1

Open wdudek82 opened 5 years ago

wdudek82 commented 5 years ago

Currently user is able to keep key pressed, causing repeated input. This should be blocked. Only Shift, Ctlr, Alt, Space, and CapsLock should remain non-blocking.

wdudek82 commented 5 years ago

My current solution to disable auto-repeat on keypress is to create list containing all pressed keys that have not triggered onKeyUp event. If keyDown event is triggered by a key included in that list, nothing happens. Keyup removes such a key form this list, and it can again trigger keydown/keypress event.