Ionic Popover freezes after refreshing the page
Hi everyone,
I found very interesting problem regarding ionic popover component. I made a test in my project by having same code like in Ionic Framework website at http://ionicframework.com/docs/api/service/$ionicPopover/ and first it works fine, but when I turn on the developer tools of Chrome on, open the mobile toolbar where you can see how it looks like in the mobile and change the mobile phone type and refresh the page, styles of ionic popover gets messy (losing style values) and logic of angular function breaks.
What I mean with angular function breaks is for example if I would have ng-click="closePopover()" it simply won't work, nothing happens. Could this be a bug? If yes could you fix it as well?
Also I had similar kind of case with other project and funny thing in this case is that whenever I open the project with ionic serve first time everything works fine except on mobile phones and when I refresh the page of that popover in the Chrome developer tools same thing happens, angular function logic breaks.
Hello , If event ng-click="closePopover()" is being executed when there is no popover it won't do anything.It is perfectly fine then but if it is being executed after ng-click="openPopover()" is executed then it should close that popover. If none of them is working then it must be a bug.
Hi @sarthakm1011. ng-click="closePopover() is not executed outside the popover. Meaning that when I open the popover it contains "X" icon which ng-click="closePopover()" is binded to.
EDIT: After testing for while I found out that it works properly ONLY when you open a new window.
Yes it works only when a new window is opened . It's similar to a modal.
@sarthakm1011 no, what I mean is when I open a new window tab in browser it works for first time, but when you hit refresh again there it doesn't work. Also with mobiles when I prepare the project for example with android by using cordova prepare android and then build it in IntelliJ Idea to get the .apk file then it doesn't work at all in mobile. I have tested same with iPhones as well, same thing happens.
After long inspection in the DOM components of this component I found out that <ion-popover-view> messed up everything and it broke also the logic of the popover. Once I deleted it, everything worked fine.
So there is a bug in this component that should be fixed.
I ran into this issue as well.
I was able to fork from the Popover: Nightly codepen and replicate the issue. Link - https://codepen.io/tcun/full/pNoRWV/
To cause the issue, open the popover, then the modal (click 'Add Comment'). From there, exit the modal using the close button (submit does nothing).
After the modal is closed, nothing can be clicked until the pen is refreshed. If the
Any news on this? I am currently experiencing the exact same issue as described above by @tcunningham07
I'm having trouble with this as well. It occur when I open a modal from popover. A class popover-open exists in my document root which block entire GUI from clicks.
@tcunningham07 codepen demostrate the issue
Here I solved it closing the popover and using a timeout before opening the modal, look
$scope.openModal = function(){
if(!$scope.modal) return;
// Call a function to close the popover
$scope.closePopover();
// Set a timeout to show the modal only in next cycle
$timeout(function(){
$scope.modal.show()
}, 0);
});
I also have this problem, but in reverse. If I open a popover from within a modal - after closing the modal - the screen is unable to be clicked. Closing the popover does not remove the popover-open css class from the body
I bandaided a fix by adding the following method to the modal controller (that also starts the popover)
$scope.$on('popover.hidden', function() { $scope.popover.remove(); $scope.popover = null; $('body').removeClass("popover-open"); });
I think this relates to #9069. I reverted to v1.3.1, waiting for a solution in latest release.
This issue was moved to driftyco/ionic-v1#86
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.