-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Destroy modal? #3200
Comments
Modal destroy does teardown correctly, I'm not sure why your example isnt working. I'll take a peek |
maybe u can write this at the beginning to 'solve' this problem: each time u write a .modal('show'), semantic will automatically add a dom in , u can remove it before the next time u use modal.
|
+1 for @Wangable's comment. This bug hit me in a React app I'm writing, where the modal stopped working after a component was unmounted and remounted again. The callbacks ( |
I encountered something very similar to what @mariusk describes. The modal eventually reaches a "dead" state where none of callbacks are called. |
The dimmer was not properly removing events in destroy. I've also modified the element namespace variable to make the code a little simpler to read. |
@jlukic http://jsfiddle.net/Ln57snr5/ |
2.2.3 is still affected http://jsfiddle.net/y80eLgau/ |
@jlukic 2.2.6 is affected too http://jsfiddle.net/k286azas/ |
This issue should be re-opened until properly fixed. |
we used an if/else statement to manage the modal, this way if it was ever created we just execute model("show") else it is created from scratch. if (typeof mdlComponentVar != 'undefined'){
//show if we had already created before
mdlComponentVar.modal( "show" );
}else {
//create otherwise
var mdlComponentVar = ...
} |
I'll revisit this issue. |
Yes please properly fix this. When the modal is closed, I'd like to have them totally removed from the DOM. I am creating them dynamically in a SPA app and can't afford to leak/have multiple instance of the same dialog lying around. |
Since the modal DOM is not created from I think a solution similar to @isawk above makes sense to me, and is similar to what I currently do in my implementation on private projects. If anyone has suggestions for how SUI can handle this without causing unexpected behaviors for people who arent using libs with tightly managed lifecycle i'd be willing to listen |
I ended up manually removing all modals from thé dom before displaying
another one. Seems to work fine on my case.
Le 29 déc. 2016 2:20 PM, "Jack Lukic" <notifications@github.com> a écrit :
… Since the modal DOM is not created from initialize it would be unexpected
for it to be removed from DOM on destroy.
I think a solution similar to @isawk <https://github.com/isawk> above
makes sense to me, and is similar to what I currently do in my
implementation on private projects.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3200 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPJl_ZqaqN35vpmAWL46DME60G2gxVzks5rNAgEgaJpZM4GQwwd>
.
|
@jlukic Perhaps not removed, but since the original DOM is modified, can I get it back to the initial state? |
This still seems to be a valid issue |
As my previous suggestion either did not work, or at some time stopped working, we did another look today to try to work around it. This time we found a workaround where we instead of explicitely calling |
This could become a breaking change for many apps, so whenever its implemented (if ever), we also need a boolean setting that tells Semantic not to destroy the DOM element on hide.
|
Seems it isn't documented and it isn't working?
http://jsfiddle.net/Ln57snr5/
The text was updated successfully, but these errors were encountered: