Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyboard: only prevent default behavior if all of repeated keydown call Event.preventDefault() #999

Closed
ph-fritsche opened this issue Jul 21, 2022 · 1 comment · Fixed by #1003
Labels
bug Something isn't working released

Comments

@ph-fritsche
Copy link
Member

Reproduction example

https://codesandbox.io/s/userevent-keyboard-prevent-imf9hv?file=/src/App.test.js

Prerequisites

  1. Render <button>
  2. Add an event handler that calls event.preventDefault() on the last of multiple keydown.
  3. 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

@github-actions
Copy link

github-actions bot commented Aug 2, 2022

🎉 This issue has been resolved in version 14.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant