Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

openedClass not removed when close/dismiss with 2 pop-ups #4184

Closed
povilass opened this issue Aug 11, 2015 · 8 comments
Closed

openedClass not removed when close/dismiss with 2 pop-ups #4184

povilass opened this issue Aug 11, 2015 · 8 comments

Comments

@povilass
Copy link

I have problem, one case like you have 2 opened pop-ups and i got 2 body classes ' class="modal-scrollable modal-open" ' when I close pop-up with modal-open class, class is not toggled

body.toggleClass(modalWindow.openedClass || OPENED_MODAL_CLASS, openedWindows.length() > 0).
@wesleycho
Copy link
Contributor

For reference, some conversation is in #4171.

@povilass
Copy link
Author

Even if you have 3 pop-ups they should use 3 different classes which should be removed not toggled.

@povilass
Copy link
Author

if(openedWindows.length() == 0) {
    body.removeClass(modalWindow.openedClass || OPENED_MODAL_CLASS);
}

Just maybe.

@wesleycho
Copy link
Contributor

It is more complicated than that - a separate data structure is likely necessary to store the class list, since there is the possibility that someone used the same custom class in multiple modals.

@povilass
Copy link
Author

Ye only way it can work with storing those classes and counting them maybe.
modal-open = count 2 you wont remove class
modal-scroll = count 1 u can removed it.

Or you have openedWindows with length() function, u got already all opened windows list in there, so method like

openedWindows.removeableClass(modalWindow.openedClass)

Which checks count of classes if count > 0 you can removed it. Should look like this.
2680 line : body.addClass(modal.openedClass || OPENED_MODAL_CLASS); should be changed to ->
modal.openedClass = modal.openedClass || OPENED_MODAL_CLASS;
body.addClass(modal.openedClass);

removeAfterAnimate(modalWindow.modalDomEl, modalWindow.modalScope, function() {
     if(openedWindows.removeableClass(modalWindow.openedClass)){
         body.removeClass(modalWindow.openedClass);
     }
});

$$stackedMap factory

removeableClass : function(class) {
    var count = 0;
    for(var index in stack) {
        if(stack[index].value.openedClass == class) {
            count++;
        }
        if(count > 1) break;
    }
    return count == 0;
}

Just my opinion and example.

@povilass
Copy link
Author

So any progress ?

@wesleycho
Copy link
Contributor

Not yet, but I did not forget about this issue - I'm a busy person, but I will make sure to get a fix before we release 0.13.4, so don't worry unless I break that promise :) .

@wesleycho wesleycho modified the milestones: 0.13.4 (Performance), 0.13.x Aug 17, 2015
@wesleycho wesleycho self-assigned this Aug 17, 2015
@povilass
Copy link
Author

Like for you, waiting for new version!!

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

Successfully merging a pull request may close this issue.

2 participants