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

Consider removing mouseenter/mouseleave polyfill #11972

Open
gaearon opened this issue Jan 5, 2018 · 4 comments
Open

Consider removing mouseenter/mouseleave polyfill #11972

gaearon opened this issue Jan 5, 2018 · 4 comments
Labels
Component: DOM React Core Team Opened by a member of the React Core Team Type: Breaking Change
Milestone

Comments

@gaearon
Copy link
Collaborator

gaearon commented Jan 5, 2018

As suggested in #10247.
Not sure we want to do it, but I decided to create an issue to track future attempts (the PR is stale).

@gaearon gaearon changed the title Remove mouseenter/mouseleave polyfill Consider removing mouseenter/mouseleave polyfill Jan 5, 2018
@gaearon gaearon added this to the 17.0.0 milestone Jan 5, 2018
@gaearon
Copy link
Collaborator Author

gaearon commented Jan 5, 2018

Also related: #10269

@jquense
Copy link
Contributor

jquense commented Jan 5, 2018

The main difficulty with removing the polyfill is the portal support. Unlike all other events, it doesn't fall out naturally from the synthetic event system. #10269 has (i think) the minimum basic code to add portal support back in. The question is whether it's better than the current polyfill /shrug

@aldendaniels
Copy link

aldendaniels commented May 29, 2018

I was pleasantly surprised that React correctly avoids firing onMouseEnter / onMouseLeave events on ancestors when moving the mouse between a portal host and its content - simulating non-portal behavior. Nice!

It looks like React doesn't have this same fix for focus/blur, but I think it ideally would. It's quite useful to be able to treat portals exactly like any other child, which means that a focusOut event caused by moving focus into a portal wouldn't bubble to portal ancestors.

I think the full list of events that need special handling might be all those that have a relatedTarget - e.g these.

Update: I think this latter bit isn't true, since React always uses onFocusIn/onFocusOut under the hood which do bubble to parents. Perhaps onMouseEnter / onMouseLeave are the only case... There are also pointer and drag events to consider.

@harrisonlo
Copy link

harrisonlo commented Jul 8, 2021

Just wanted to chime in here to express the need for the native onmouseleave event. React's onMouseLeave currently maps to the native onmouseout event, which behaves differently when hovering through a child element in portal. Something like #10269 seems to solve the problem. I ended up having to access the native onmouseleave via a ref, but that's not ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: DOM React Core Team Opened by a member of the React Core Team Type: Breaking Change
Projects
None yet
Development

No branches or pull requests

5 participants