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

Mouseleave event returns incorrect relatedTarget #1182

Open
MichailShcherbakov opened this issue Dec 13, 2023 · 0 comments
Open

Mouseleave event returns incorrect relatedTarget #1182

MichailShcherbakov opened this issue Dec 13, 2023 · 0 comments
Labels
bug Something isn't working needs assessment This needs to be looked at by a team member

Comments

@MichailShcherbakov
Copy link

Reproduction example

https://codesandbox.io/p/sandbox/old-butterfly-239l2c?file=%2Fsrc%2FApp.test.js%3A4%2C37

Prerequisites

  1. Render the structure below
<div>
      <p data-testid="text1" onMouseLeave={onMouseLeave}>text1</p>
      <p data-testid="text2">text2</p>
</div>
  1. Find these fields
  const text1 = screen.getByTestId('text1')
  const text2 = screen.getByTestId('text2')
  1. Move the cursor
await user.pointer([{target: text1}, {target: text2}])

Expected behavior

event.relatedTarget should be <p data-testid="text2">text2</p>

Actual behavior

event.relatedTarget is global

User-event version

14.5.1

Environment

Testing Library framework: @testing-library/react@14.1.2

JS framework: react@18.2.0

Test environment: vitest@1.0.4

DOM implementation: jsdom@23.0.1

Additional context

No response

@MichailShcherbakov MichailShcherbakov added bug Something isn't working needs assessment This needs to be looked at by a team member labels Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs assessment This needs to be looked at by a team member
Projects
None yet
Development

No branches or pull requests

1 participant