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

Smart close: check if we're destroying the right instance #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xfra35
Copy link
Contributor

@xfra35 xfra35 commented Aug 28, 2015

Since the plugin handles only one modal at a time, the need may arise to have one modal:close trigger another modal:open in order to implement state management. Here's an example:

$modal1.on('modal:close',function(){
  $modal2.modal();
});

This doesn't play nicely with the current codebase: $modal2 shows up but stop responding afterwards (uncloseable). The reason is that the current instance gets destroyed by the first modal close() call.

This PR intends to fix that by adding a simple check before destroying the current instance.

NB: Unsubscribing to keydown.modal is performed a bit earlier for the same reason: this.hide() may trigger another modal:open.

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

Successfully merging this pull request may close these issues.

None yet

1 participant