Fix regression for handling mouseenter/mouseleave events introduced by #33310#33679
Merged
Fix regression for handling mouseenter/mouseleave events introduced by #33310#33679
mouseenter/mouseleave events introduced by #33310#33679Conversation
there is a regression introduced by twbs#33310 - this would have catched that
…wbs#33310 the old logic only worked for parent-child movement since it checked for the relatedTarget to contain the delegateTarget - this should be fixed with this
mdo
approved these changes
Apr 19, 2021
mouseenter/mouseleave events introduced by #33310
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
relatedTargetto contain thedelegatedTarget.This is correct while moving from the parent onto a child element (
mouseover) with therelatedTargetbeing the parent element that contains thedelegatedTarget(child). And also while moving from the child onto the parent (mouseout) with therelatedTargetbeing 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
delegatedTargetnot 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.. 😓