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

Fix onMouseEnter is fired on disabled buttons #17675

Merged
merged 1 commit into from
Feb 4, 2020

Conversation

AlfredoGJ
Copy link
Contributor

@AlfredoGJ AlfredoGJ commented Dec 20, 2019

This pull request fixes issue #17229. I modified shouldPreventMouseEvent function to include onMouseEnter and added a new test to ReactBrowserEventEmmiter-test.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 20, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 64336e9:

Sandbox Source
twilight-sound-902nk Configuration

@sizebot
Copy link

sizebot commented Dec 20, 2019

Warnings
⚠️ Base commit is broken: 1b9328c

Size changes (experimental)

Generated by 🚫 dangerJS against 64336e9

@sizebot
Copy link

sizebot commented Dec 20, 2019

Warnings
⚠️ Base commit is broken: 1b9328c

Size changes (stable)

Generated by 🚫 dangerJS against 64336e9

@AlfredoGJ AlfredoGJ reopened this Dec 20, 2019
@benbot
Copy link

benbot commented Dec 29, 2019

should onMouseExit be on that switch statement as well?

@AlfredoGJ
Copy link
Contributor Author

@benbot Unlike onMouseEnter, onMouseExit performs well and has not the same bug. onMouseExit event is not even generated for a disabled button. I'm thinking that maybe none of these event names should be in that switch statement and the bug is in the event registration phase.

I 'll be doing deeper research these days. Meanwhile, this could a useful workaround for someone.

Copy link

@StefanNieuwenhuis StefanNieuwenhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@trueadm trueadm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems okay to me. Ideally we should remove all the custom disabled logic and come up with a better solution in the future for the event system, but for now this should fix this issues at hand.

@trueadm trueadm merged commit 812277d into facebook:master Feb 4, 2020
@mohsinulhaq
Copy link

This fixes #4251 as well, right?

@SebVory
Copy link

SebVory commented Feb 27, 2020

What if you want to display tooltip / help text why user cannot perform action connected with disabled button when user hovers the button? (my real world case). The fix should be to make onMouseExit enabled and have both enabled and not disable the onMouseEnter. If you know nice way (not hack like fake-disable button) how to solve my example case without onMouseEnter onMouseEnter I am free to discuss. But otherwise it should be both enabled in my opinion.

disabled button should just not perform event (on click) but the users still should know why they cannot perform the events (on hover)

@gaearon
Copy link
Collaborator

gaearon commented Feb 27, 2020

Can you please file a new issue to discuss?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.