Fix regression for handling mouseenter
/mouseleave
events introduced by #33310
#33679
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sorry had a little logic error with this.
The old logic was based on
relatedTarget
to contain thedelegatedTarget
.This is correct while moving from the parent onto a child element (
mouseover
) with therelatedTarget
being the parent element that contains thedelegatedTarget
(child). And also while moving from the child onto the parent (mouseout
) with therelatedTarget
being the parent element that contains thedelegatedTarget
(child).So for parent-child relationships this was working totally fine.
The problem comes when moving onto sibling or unconnected elements. The updated logic should handle this properly now, as it checks for the
delegatedTarget
not to contain therelatedTarget
. Which is the case for parent (related) -- mouseover --> child (delegated) and parent (related) <-- mouseout -- child (delegated) movements. And also with sibling/unconnected (related) -- mouseover --> listener (delegated) and sibling/unconnected (related) <-- mouseout -- listener (delegated).Sorry again.. 😓