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

Modal state is not inactive after modal is closed #96

Open
akrawchyk opened this issue Feb 17, 2016 · 1 comment
Open

Modal state is not inactive after modal is closed #96

akrawchyk opened this issue Feb 17, 2016 · 1 comment

Comments

@akrawchyk
Copy link

The undelegateModalEvents function is not called when a modal is canceled or closed for another reason. It looks as though the modal checks if we have a viewContainer, here

if @regionEnabled
and here
if @regionEnabled
, except @regionEnabled does not seem to be set anywhere else in the code. That means destroy will always be called on a successful triggerCancel and triggerSubmit.

So, I think we should call undelegateModalEvents every time destroy is called in order to always remove events from the inactive modal and return the modal state back to inactive (@active = false called only in the undelegateModelEvents function here

).

@akrawchyk
Copy link
Author

BTW there is an easy workaround for this. When extending the modal, simply call undelegateModalEvents in the onDestroy function:

var Modal = Backbone.Modal.extend({
    ...
    onDestroy: {
        this.undelegateModalEvents();
    },
    ...
});

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

No branches or pull requests

1 participant