Move event.preventDefault() calls inside the condition that checks if the key pressed is the one we want. Current implementation prevents normal use of keyboard like reloading the page.
Add a unsubscribe() method to remove event listeners. I can't see any way to remove them in current implementation, and this is a crucial feature.
Move
event.preventDefault()
calls inside the condition that checks if the key pressed is the one we want. Current implementation prevents normal use of keyboard like reloading the page.Add a
unsubscribe()
method to remove event listeners. I can't see any way to remove them in current implementation, and this is a crucial feature.