-
Notifications
You must be signed in to change notification settings - Fork 47.7k
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
Bug: MouseEnter does not fire when coming _from_ disabled elements #19419
Comments
@jquense if I comment the SyntheticEvent onMouseEnter(L19). |
you don't need to comment it, the native one always fires. It's there to illustrate that React is not mimicking the native behavior correctly |
Currently investigating this (and hopefully fixing) |
Repro'd via a broken test: EDIT: Actually I have to fix the test. I had the sanity check and the test case backwards. Oops! |
FWIW there isn't any easy fix for this without changing all the mouse enter/leave event dispatching. I've already posted a few PRs that work around this a few ways but they are many years old at this point. Tbh the easiest fix would be to just use native mouse enter and leave |
@jquense I think the problem is that would require attaching a native event listener 1:1 for each synthetic event which is potentially a huge performance hit when you can take advantage of event delegation instead. I think I might have a reasonable fix for this. |
https://jsfiddle.net/x9ofu5e1/7/ This example includes mouseenter is working as per expectation in react as well, it is not triggered when button is disabled. |
FWIW, the above fiddle does trigger the |
React version: 16.13.1
Steps To Reproduce
https://codesandbox.io/s/eager-euler-c72fw?file=/src/App.js
mouseenter
listener.mouseenter
does not fireLink to code example: https://codesandbox.io/s/eager-euler-c72fw?file=/src/App.js
The current behavior
mouseenter
does not fire because React calculates mouseenter/leave based on the relative element of the opposing event.e.g.
mouseenter
calculated from themouseout
on the button. Browsers do not fire pointer events on disabled elementsThe expected behavior
mouseenter
should firePrevious issue: #4251
The text was updated successfully, but these errors were encountered: