-
Notifications
You must be signed in to change notification settings - Fork 252
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
Inputs are not focused when clicked (v14) #1002
Comments
Are you sure this is an issue with |
I did also experience the issue when using user-event directly, and as I describe in the readme, forcing npm to download v13 causes user-event to work correctly. But I can modify the reproduction if that's helpful. |
I've pushed an update to the reproduction to import from |
Thanks for the report. This is odd: In Firefox the focus is set into the element per
|
I'm currently working on updating |
With https://codesandbox.io/s/intelligent-zhukovsky-8z89zj?file=/src/App.js |
If I use the convenience method ( |
It does get focus, but in Chrome, it does not get a cursor, so typing into the field after the click does not work. |
I still have this problem, focus is not given to the input when using |
I could make it work using For example :
|
Actually the |
Hi, has anyone found a workaround to this issue? It's still blocking my migration to user-event 14, and I'd love to update. |
Actually, I tried upgrading anyway, and my tests are passing, though the codesandbox reproduction above still fails. Not sure what's going on, TBH, but I'll take it! |
Just ran into this issue while upgrading to v14 - I'm on |
I have the same problem with focus. I downgraded to version 13.5.0 and focus after click is working |
I have the same problem. To me, it is working on storybook (chrome/chromium) but not on jest (jsdom) |
This comment was marked as off-topic.
This comment was marked as off-topic.
I do notice that focus-visible is sometimes applied to elements that are clicked, but not always. It results in snapshot flake, which is pretty annoying. But that seems like a separate issue from the core of this one. |
Reproduction example
https://github.com/IanVS/storybook-testing-user-event-click-focus
Prerequisites
await userEvent.click(getByRole('textbox'));
for exampleExpected behavior
The input element should be fully focused, ready to accept user input (flashing cursor).
Actual behavior
The input is half-way focused, with a focus ring, but no flashing cursor.
User-event version
14.3.0
Environment
Testing Library framework:
@testing-library/[email protected]
JS framework:
[email protected]
Test environment:
[email protected]
DOM implementation:
browser
Additional context
This was working correctly in V13. I have instructions in the README of the reproduction of how to verify.
The text was updated successfully, but these errors were encountered: