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

Pointer events are not triggered correctly in parent elements #957

Closed
Parnswir opened this issue May 13, 2022 · 4 comments · Fixed by #1003
Closed

Pointer events are not triggered correctly in parent elements #957

Parnswir opened this issue May 13, 2022 · 4 comments · Fixed by #1003
Labels
accuracy Improves the accuracy of how behavior is simulated released

Comments

@Parnswir
Copy link

Parnswir commented May 13, 2022

Reproduction example

https://codesandbox.io/s/cool-leftpad-3djsvy?file=/README.md

Prerequisites

  1. Render a container element and a child element (<div id="container"><div id="child">Content</div></div>)
  2. Use await userEvent.hover(screen.getByText("Content")); to trigger a pointerenter event

Expected behavior

The container element should also get the pointer event.

Actual behavior

The container element does not get an event.

User-event version

14.1.1

Environment

"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^14.0.0",
"babel-jest": "^27.4.5",
"jest": "^28.0.3"

See https://github.com/Parnswir/user-event-14-hover-reproduction for working example with v13.5 (Parnswir/user-event-14-hover-reproduction@9d64c4c) and broken example with v14 (Parnswir/user-event-14-hover-reproduction@3a24bf0)

Additional context

Originally discussed in #944

cc: @ph-fritsche

@Parnswir Parnswir added bug Something isn't working needs assessment This needs to be looked at by a team member labels May 13, 2022
@ph-fritsche ph-fritsche added accuracy Improves the accuracy of how behavior is simulated and removed needs assessment This needs to be looked at by a team member bug Something isn't working labels May 13, 2022
@frabcus
Copy link

frabcus commented Jun 15, 2022

This is happening for me too - similar example to reproduce it https://github.com/frabcus/user-event-hover-child-bug with a test without the nested element (works) and with (doesn't work).

@ph-fritsche
Copy link
Member

@all-contributors add @Parnswir bug

@allcontributors
Copy link
Contributor

@ph-fritsche

I've put up a pull request to add @Parnswir! 🎉

@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
accuracy Improves the accuracy of how behavior is simulated released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants