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

Patch userEvent.type to stop typing if the target element has lost focus #16143

Open
shilman opened this issue Sep 23, 2021 · 0 comments
Open

Comments

@shilman
Copy link
Member

shilman commented Sep 23, 2021

As a user, if I happen to click outside of the focused element as userEvent.type is executing, I want the typing to stop, so that it does not trigger random keyboard shortcuts in the Storybook UI

We should patch userEvent.type to check for focus before it fires a keyboard event, and to stop execution via an exception, in the case that the focus has changed.

We should probably also contribute this back to TestingLibrary

=> "In testing-library, empty the event queue when a blur or focus event is received" - @ghengeveld

┆Issue is synchronized with this Asana task by Unito

@shilman shilman added this to the 6.4 Interaction testing milestone Sep 23, 2021
@shilman shilman changed the title Patch userEvent.type to stop typing if the target element has lost focus Patch userEvent.type to stop typing if the target element has lost focus Sep 23, 2021
@shilman shilman added the bug label Sep 23, 2021
@shilman shilman modified the milestones: 8.x interactions, 8.x test UI Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants