Skip to content

Commit

Permalink
fix(popup): prevent back to back popups from dismissing background. F…
Browse files Browse the repository at this point in the history
…ixes #2071
  • Loading branch information
perrygovier committed Sep 26, 2014
1 parent 10068e2 commit 5658a4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion js/angular/service/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB
// click which would trigging whatever was underneath this
$ionicBody.removeClass('popup-open');
}, 400);
$ionicBackdrop.release();
$timeout(function(){
if(popupStack.length === 0)$ionicBackdrop.release();

This comment has been minimized.

Copy link
@jbollacke

jbollacke Nov 24, 2014

I think this is in the scope of ionicBackdrop and so $ionicBackdrop.release() should be called for every popup, not just the last one.

}, config.stackPushDelay || 0);
($ionicPopup._backButtonActionDone || angular.noop)();
}
return result;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/angular/service/popup.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ describe('$ionicPopup service', function() {
$ionicPopup.show();
fakePopup.responseDeferred.resolve();
$timeout.flush();
expect($ionicBackdrop.release).toHaveBeenCalled();
expect(backDoneSpy).toHaveBeenCalled();
$timeout.flush();
expect($ionicBackdrop.release).toHaveBeenCalled();
expect(document.body.classList.contains('popup-open')).toBe(false);
}));
it('template should only overwrite prompt input if it includes html', inject(function($timeout) {
Expand Down

1 comment on commit 5658a4d

@jbollacke
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May introduce #2304. Haven't looked into it any further.

Please sign in to comment.