bug (and fix): app FROZEN: class popover-open not removed from body when closing a popover from a modal
Ionic version: [x] 1.x [ ] 2.x
I'm submitting a ... [x] bug report [ ] feature request
Current behavior:
The class popover-open is not removed from the body, when a popover is closed from a modal view.
Expected behavior:
The class popover-open should be removed from the body.
Steps to reproduce:
Open a modal Add a control which allows opening a popover from this modal. Close the popover, by tapping one of its items, or tapping "outisde"
Related code:
The issue is due to this commit https://github.com/driftyco/ionic/commit/6ed725325987559371450bedfed9ed74f9f153cd and I explained why here https://github.com/driftyco/ionic/commit/6ed725325987559371450bedfed9ed74f9f153cd#commitcomment-20105088. Copy/paste from my comment:
This commit creates an issue: The same
hidemethod is also used bypopover.The logic behind
if (!modalStack.length) {is "if modalStack is empty, then there is no modal, then we can executeremoveClass"... Which is not correct, asmodalStackalso contains popovers, and thehidemethod must also handle the removal of the classpopover-open.You may open a
popoverP1 in amodalM1. You now have M1 and P1 in themodalStack. This will result in having bothmodal-openandpopover-openclass inbody. When callinghideof thepopover(dismiss, tapped...), the condition will not be filled becausemodalStackstill contains an item: the modal M1. Thus, classpopover-openis not removed frombody... You can still close the modal, but then your UI comes totally un-tappable and looks like "frozen".
Other information:
Happening since ionic 1.3.2 (see the commit https://github.com/driftyco/ionic/commit/6ed725325987559371450bedfed9ed74f9f153cd).
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
Your system information:
Cordova CLI: 6.4.0
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 3.16
Node Version: v6.9.1
Recommandation:
Instead of doing
if (!modalStack.length) {
We should do something like:
var otherSibling = false;
for (var i = 0; i < modalStack.length; ++i) {
if (modalStack[i].viewType === self.viewType) {
// there are other modal (or popover, depending on viewType)
otherSibling = true;
break;
}
}
if (!otherSibling) {
Related to #8582 and #9069. I am also waiting for a fix.
Hi! The code I suggested does work for me and doesn't seem to create new issues. If you don't mind building/using your own version of ionic :) (this is something you should seriously think about if you dig deep inside the framework, as this kind of issue is very common).
@brandyscarney Hi Brandy! I know you're all busy with ionic 2, etc, but is there any news regarding this (serious) issue for ionic 1? Thanks. BTW, happy new year :-)
This issue was moved to driftyco/ionic-v1#53
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.