-
Notifications
You must be signed in to change notification settings - Fork 240
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
hover then click children lost target #1187
Labels
Comments
wsl874
added
bug
Something isn't working
needs assessment
This needs to be looked at by a team member
labels
Jan 18, 2024
wsl874
changed the title
hover then click children failed test
hover then click children lost target
Jan 18, 2024
I can confirm this issue. Regular clicks work, but combined with a hover action it does not. My setup is exactly that of the example above. Environment"@testing-library/react": "14.0.0" Workaround:In case someone else is also blocked from writing their test - using testing-libraries
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Reproduction example
https://codesandbox.io/p/devbox/react-jest-test-4yx2wr?file=/src/App.js
Prerequisites
Expected behavior
child element displayed and click event is triggered
Actual behavior
child element hidden, and click event is not triggered
User-event version
14.5.2
Environment
Testing Library framework:
@testing-library/[email protected]
JS framework:
[email protected]
Test environment:
DOM implementation:
Additional context
I debugged the code and found that the pointer event compared prevTarget and currTarget. When they are not equal, the mouseLeave event will be triggered, which will cause the child elements to be hidden and the target to be lost in subsequent events.
Maybe we can determine whether to trigger the mouseLeave event based on the node level, which will be closer to the browser's implementation.
The text was updated successfully, but these errors were encountered: