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

Bug: relatedTarget is undefined in firefox #19572

Closed
zoltan-mihalyi opened this issue Aug 10, 2020 · 2 comments
Closed

Bug: relatedTarget is undefined in firefox #19572

zoltan-mihalyi opened this issue Aug 10, 2020 · 2 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@zoltan-mihalyi
Copy link

React.MouseEvent#relatedTarget is undefined in firefox on windows (should be null)

React version: 16.12.0

Steps To Reproduce

  1. create an onMouseOut event listener on a html element
  2. move the mouse to the element
  3. move the mouse outside the window (the mouse should not enter other html elements in the process)

Link to code example: https://codesandbox.io/s/strange-wiles-c4ku2
In the example, if you move the mouse from the blue box to the top, you see the types of event.relatedTarget and event.nativeEvent.relatedTarget, you see "undefined, object".

The current behavior

when event.nativeEvent.relatedTarget is null, event.relatedTarget is undefined.

The expected behavior

event.relatedTarget should be null

@zoltan-mihalyi zoltan-mihalyi added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Aug 10, 2020
@claytercek
Copy link
Contributor

looks like this is due to the fact that mozilla doesn't support the fromElement or toElementevent property, which is what the fallback uses when relatedTarget doesn't exist.

relatedTarget: function(event) {
return (
event.relatedTarget ||
(event.fromElement === event.srcElement
? event.toElement
: event.fromElement)
);
},

@gaearon
Copy link
Collaborator

gaearon commented Aug 17, 2020

This was fixed by #19607.

@gaearon gaearon closed this as completed Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

3 participants