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

Popover and Modals interfering, body classes do not get removed - bug newly introduced with 1.3.2 #9069

Closed
SebastianSchirmer opened this issue Nov 7, 2016 · 14 comments

Comments

@SebastianSchirmer
Copy link

Short description of the problem:

Commit 6ed7253 introduces a bug that the "popover-open" class is not removed from body if a modal is open at the same time.

What behavior are you expecting?

Removing a popover must remove the "popover-open" class from body element, even though a modal is open at the same time.

Steps to reproduce:

  1. open a modal
  2. open a popover
  3. close the popover (modal still open)
    --> class "popover-open" not removed from body element
// if condition was newly introduced
if (!modalStack.length) {
     $ionicBody.removeClass(self.viewType + '-open');
}

As modalStack can contain both modals and popovers, the newly introduced if-condition must take the entry type into consideration, i.e. "modal" or "popover". Otherwise, a "popover-open" class is not removed if modalStack contains any modals and vice versa for class "modal-open".

Which Ionic Version? 1.x or 2.x
1.3.2

Run ionic info from terminal/cmd prompt: (paste output below)

Cordova CLI: 6.4.0
Gulp version: CLI version 1.2.2
Gulp local: Local version 3.9.1
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.0.0-beta.20
ios-deploy version: 1.9.0
ios-sim version: 5.0.10
OS: Mac OS X El Capitan
Node Version: v4.6.0
Xcode version: Xcode 8.1 Build version 8B62

@cBevilaqua
Copy link

Already happened with me. Yesterday i updated to version 1.3.2 and after i opened a modal from a popover, for the second time, the screen has freezed and i see the "popover-open" in the body that is causing this issue.

@SebastianSchirmer
Copy link
Author

Well, yes, it seems I forgot to mention this crucial fact: The screen freezes after opening a modal from a popover and then closing the modal. No screen interaction is possible anymore then.

@SebastianSchirmer
Copy link
Author

@brandyscarney this is v1 not v2

@brandyscarney brandyscarney added v1 and removed v2 labels Nov 10, 2016
@brandyscarney
Copy link
Member

@leschirmeur Oops, sorry about that. I must have been trigger happy selecting issues to label. :)

@SebastianSchirmer
Copy link
Author

@brandyscarney :-)

@alaa-alshamy
Copy link

alaa-alshamy commented Nov 21, 2016

and this bug makes the app freez in this scenario:
1- open a popover
2- open a modal from that popover without closing the popover
3- then close the modal and popover
and then the app got freez

and that's because the "modal-open" class doesn't remove if u closed the modal and there's a popover open and that class preventing any action on the page

@alaa-alshamy
Copy link

alaa-alshamy commented Nov 21, 2016

sorry i didn't noticed that u r mentioned that scenario above in the comments guys :)

@TomSeldon
Copy link

Hi guys, I've just run into the same issue.

Although this appears to be a regression in 1.3.2, it's easy enough to work around.

In my case I was doing something that boiled down to:

myPopover.show();

// on clicking an item in the popover

myPopover.hide();

$ionicModal.fromTemplateUrl('foo.html', { scope: $scope })
    .then(modal => {
        modal.show();
    });

This used to work, but now hits the issue reported here.

However, by waiting for the popover to hide before showing the modal, then the popover-open class is removed from body correctly.

So, the above changes to:

myPopover.show();

// on clicking an item in the popover

myPopover.hide()
    .then(() => {
        // Popover is hidden, so now open the modal
        $ionicModal.fromTemplateUrl('foo.html', { scope: $scope })
            .then(modal => {
                modal.show();
            });
    });

@alaa-alshamy
Copy link

i noticed that the problem not with popover only , it's happened if there's any tow of popup active together

so it's happened if there's any tow of those together : modal - alert - popover - confirm and i think even loading

any tow of those i mentioned above active together when close one of them the class will not remove

@ps1dr3x
Copy link

ps1dr3x commented Dec 5, 2016

+1

@VinceOPS
Copy link

VinceOPS commented Dec 9, 2016

Hi. As referenced a few minutes ago, I created an issue for the same bug: #9538.

I wrote a fix (didn't take the pain to create a proper pull request as I don't know if the team is still working on v1...).

Find:

if (!modalStack.length) {

And replace by:

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

Enjoy

@TomSeldon
Copy link

Hi @VinceOPS,

I was under the impression that whilst there won't be new features for v1, bug fixes are still going to be addressed.

If you can, I'd definitely create a PR with the fix! :)

@jgw96
Copy link
Contributor

jgw96 commented Jan 13, 2017

This issue was moved to ionic-team/ionic-v1#71

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 5, 2018

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 ionitron-bot bot unassigned jgw96 Sep 5, 2018
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants