File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
packages/react-dom/src/events/plugins Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -65,16 +65,18 @@ const EnterLeaveEventPlugin = {
65
65
topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER ;
66
66
const isOutEvent =
67
67
topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT ;
68
- const related = nativeEvent . relatedTarget || nativeEvent . fromElement ;
69
-
70
- if ( isOverEvent && ( eventSystemFlags & IS_REPLAYED ) === 0 && related ) {
71
- // Due to the fact we don't add listeners to the document with the
72
- // modern event system and instead attach listeners to roots, we
73
- // need to handle the over event case. To ensure this, we just need to
74
- // make sure the node that we're coming from is managed by React.
75
- const inst = getClosestInstanceFromNode ( related ) ;
76
- if ( inst !== null ) {
77
- return ;
68
+
69
+ if ( isOverEvent && ( eventSystemFlags & IS_REPLAYED ) === 0 ) {
70
+ const related = nativeEvent . relatedTarget || nativeEvent . fromElement ;
71
+ if ( related ) {
72
+ // Due to the fact we don't add listeners to the document with the
73
+ // modern event system and instead attach listeners to roots, we
74
+ // need to handle the over event case. To ensure this, we just need to
75
+ // make sure the node that we're coming from is managed by React.
76
+ const inst = getClosestInstanceFromNode ( related ) ;
77
+ if ( inst !== null ) {
78
+ return ;
79
+ }
78
80
}
79
81
}
80
82
@@ -100,6 +102,7 @@ const EnterLeaveEventPlugin = {
100
102
let from ;
101
103
let to ;
102
104
if ( isOutEvent ) {
105
+ const related = nativeEvent . relatedTarget || nativeEvent . toElement ;
103
106
from = targetInst ;
104
107
to = related ? getClosestInstanceFromNode ( related ) : null ;
105
108
if ( to !== null ) {
You can’t perform that action at this time.
0 commit comments