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
Merged

Conversation

@AlfredoGJ
Copy link
Contributor

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

This comment has been minimized.

Copy link

codesandbox 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

This comment has been minimized.

Copy link

sizebot commented Dec 20, 2019

Warnings
⚠️ Base commit is broken: 1b9328c

Size changes (experimental)

Generated by 🚫 dangerJS against 64336e9

@sizebot

This comment has been minimized.

Copy link

sizebot commented Dec 20, 2019

Warnings
⚠️ Base commit is broken: 1b9328c

Size changes (stable)

Generated by 🚫 dangerJS against 64336e9

@AlfredoGJ AlfredoGJ force-pushed the AlfredoGJ:master branch from dc90680 to 99a4e38 Dec 20, 2019
@AlfredoGJ AlfredoGJ closed this Dec 20, 2019
@AlfredoGJ AlfredoGJ force-pushed the AlfredoGJ:master branch from 99a4e38 to 1b9328c Dec 20, 2019
@AlfredoGJ AlfredoGJ reopened this Dec 20, 2019
@benbot

This comment has been minimized.

Copy link

benbot commented Dec 29, 2019

should onMouseExit be on that switch statement as well?

@AlfredoGJ

This comment has been minimized.

Copy link
Contributor Author

AlfredoGJ commented Dec 31, 2019

@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 left a comment

👍

@trueadm
trueadm approved these changes Feb 4, 2020
Copy link
Member

trueadm left a comment

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
21 checks passed
21 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: build_experimental Your tests passed on CircleCI!
Details
ci/circleci: flow Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: lint_build Your tests passed on CircleCI!
Details
ci/circleci: process_artifacts Your tests passed on CircleCI!
Details
ci/circleci: process_artifacts_experimental Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: sizebot Your tests passed on CircleCI!
Details
ci/circleci: sizebot_experimental Your tests passed on CircleCI!
Details
ci/circleci: test_build Your tests passed on CircleCI!
Details
ci/circleci: test_build_devtools Your tests passed on CircleCI!
Details
ci/circleci: test_build_experimental Your tests passed on CircleCI!
Details
ci/circleci: test_build_prod Your tests passed on CircleCI!
Details
ci/circleci: test_build_prod_experimental Your tests passed on CircleCI!
Details
ci/circleci: test_dom_fixtures Your tests passed on CircleCI!
Details
ci/circleci: test_source Your tests passed on CircleCI!
Details
ci/circleci: test_source_experimental Your tests passed on CircleCI!
Details
ci/circleci: test_source_persistent Your tests passed on CircleCI!
Details
ci/circleci: test_source_prod Your tests passed on CircleCI!
Details
ci/codesandbox Building packages succeeded.
Details
@mohsinulhaq

This comment has been minimized.

Copy link

mohsinulhaq commented Feb 26, 2020

This fixes #4251 as well, right?

@LordSeb

This comment has been minimized.

Copy link

LordSeb 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

This comment has been minimized.

Copy link
Member

gaearon commented Feb 27, 2020

Can you please file a new issue to discuss?

This was referenced Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

You can’t perform that action at this time.