Closed xAlstrat closed 6 years ago
I would like to use arrow keys for moving elements. This works great. But when I press 'up' and 'down' keys the browser scroll is also activated.
How can I prevent this default behavior? I'm working with React components:
<KeyHandler keyEventName={KEYPRESS} keyValue="ArrowLeft" onKeyHandle={this.moveEventLeft} />
The function doesn't seem to have an event parameter.
Thanks !
I'm blind.
The only parameter is an event. Just had to do e.preventDefault().
e.preventDefault()
I would like to use arrow keys for moving elements. This works great. But when I press 'up' and 'down' keys the browser scroll is also activated.
How can I prevent this default behavior? I'm working with React components:
<KeyHandler keyEventName={KEYPRESS} keyValue="ArrowLeft" onKeyHandle={this.moveEventLeft} />
The function doesn't seem to have an event parameter.
Thanks !