ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug (and fix): app FROZEN: class popover-open not removed from body when closing a popover from a modal

Open VinceOPS opened this issue 9 years ago • 5 comments

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 hide method is also used by popover.

The logic behind if (!modalStack.length) { is "if modalStack is empty, then there is no modal, then we can execute removeClass"... Which is not correct, as modalStack also contains popovers, and the hide method must also handle the removal of the class popover-open.

You may open a popover P1 in a modal M1. You now have M1 and P1 in the modalStack. This will result in having both modal-open and popover-open class in body. When calling hide of the popover (dismiss, tapped...), the condition will not be filled because modalStack still contains an item: the modal M1. Thus, class popover-open is not removed from body... 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) {

VinceOPS avatar Dec 07 '16 16:12 VinceOPS

Related to #8582 and #9069. I am also waiting for a fix.

ach avatar Dec 09 '16 14:12 ach

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).

VinceOPS avatar Dec 09 '16 14:12 VinceOPS

@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 :-)

VinceOPS avatar Jan 06 '17 11:01 VinceOPS

This issue was moved to driftyco/ionic-v1#53

jgw96 avatar Jan 13 '17 21:01 jgw96

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.

ionitron-bot[bot] avatar Sep 05 '18 01:09 ionitron-bot[bot]