Reproduction example
https://codesandbox.io/s/userevent-keyboard-prevent-imf9hv?file=/src/App.test.js
Prerequisites
- Render
<button>
- Add an event handler that calls
event.preventDefault() on the last of multiple keydown.
- Press space bar
Expected behavior
A click event is dispatched if there is any keydown without a call to event.preventDefault().
Actual behavior
The click event is only dispatched if the last keydown does not prevent default.
User-event version
14.3.0
Environment
Testing Library framework:
JS framework:
Test environment:
DOM implementation:
Additional context
No response