Skip to content

Commit

Permalink
fix event.relatedTarget fallback logic for firefox (#19607)
Browse files Browse the repository at this point in the history
* fix event.relatedTarget fallback logic for firefox

* check if relatedTarget is undefined for fallback
  • Loading branch information
claytercek authored Aug 14, 2020
1 parent 1d5e10f commit fe6d052
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/react-dom/src/events/SyntheticEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ export const MouseEventInterface = {
button: 0,
buttons: 0,
relatedTarget: function(event) {
return (
event.relatedTarget ||
(event.fromElement === event.srcElement
if (event.relatedTarget === undefined)
return event.fromElement === event.srcElement
? event.toElement
: event.fromElement)
);
: event.fromElement;

return event.relatedTarget;
},
movementX: function(event) {
if ('movementX' in event) {
Expand Down

0 comments on commit fe6d052

Please sign in to comment.