-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Modal calls onClose when it opens #2493
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
Thanks! Temporary WorkaroundsIn this case, the click on the button propagates up to the modal dimmer. It is triggered as a click on the dimmer and closes the Modal.
Problem & FixWe improved the logic for detecting clicks inside of elements when the result of the click removed the In the cases that we an PR coming. |
Just confirming that upgrade from 0.77.2 to 0.78.2 fixed exactly the same issue in our project. Thanks! |
Steps
Use a
Popup
with aButton
trigger, that indirectly controls the state of aModal
, which is nested inside a modal wrapper. Pass a callback function to the modal wrapper component asonClose
, which resets the state of the parent component. Click the Popup trigger button to open theModal
, and nothing happens. TheModal
is calling itsonClose
event when you click the trigger.This issue only began to occur when I upgraded to
semantic-ui-react
v. ^0.78.0.Expected Result
The
Modal
onClick
event does not fire unless triggered by anonClick
event within the context of theModal
, and not its parent context.Actual Result
The
onClose
function will be called by the underlying semantic-ui-reactModal
when thePopup
trigger is clicked. As such, theModal
never opens, because it is 'closed' as it opens.Version
0.78.0
Testcase
https://codesandbox.io/s/l7p5l52n2m
The text was updated successfully, but these errors were encountered: