mouseenter fires on disabled inputs whereas mouseleave does not
See original GitHub issueThere is an asymmetry to EnterLeave event plugin. Since mouseenter
is created from the relativeTarget of the mouseout
event it fires even though the target is disabled. Since the mouseleave
is the inverse, i.e requires that the disabled element fire a mouseout, it doesn’t fire a mouseleave
for the disabled element.
I am pretty sure the correct behavior here is that neither event should fire if its target is disabled, since this mirrors mouseout
. No idea if none-chrome browsers have the same behavior for which mouse events fire on disabled elements.
Additional caveat I just realized, React is probably also not firing mousenter
events in the case where the mouse leaves a disabled element into a non disabled element
Issue Analytics
- State:
- Created 8 years ago
- Reactions:26
- Comments:39 (14 by maintainers)
Top Results From Across the Web
html - Mouseenter is never triggered when entering through ...
Mouseenter is never triggered when entering through disabled child element · Move mouse over blue box · Move mouse over checkbox · No...
Read more >React does not fire onMouseLeave events on a disabled button
React does not fire onMouseLeave events on a disabled button. December 22, 2018 ... Consider removing mouseenter/mouseleave polyfill.
Read more >11382 (Mouseenter doesn't fire on a disabled input element)
I am thinking we may want to ban only click events with the idea that those are the most common events that should...
Read more >Moving the mouse: mouseover/out, mouseenter/leave
relatedTarget – is the element from which the mouse came ... Events mouseenter/mouseleave do not bubble. ... Fire Orange Fame, Southeast
Read more >Element: mouseleave event - Web APIs | MDN
This means that mouseleave is fired when the pointer has exited the element and all of its descendants, whereas mouseout is fired when...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There is also a css workaroud:
Updated @CoryDanielson’s fiddle: https://jsfiddle.net/Sl1v3r/sLsut3cy/
There is also a problem for elements, containing disabled element.
onMouseEnter
works,onMouseLeave
doesn’t.Native
mouseleave
event works as expected in the same situation.