Skip to content

Commit

Permalink
fix(modal): remove 'modal-open' from body
Browse files Browse the repository at this point in the history
  • Loading branch information
genesy authored and adamdbradley committed Aug 21, 2016
1 parent 08d7425 commit 6ed7253
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/angular/service/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
}

return $timeout(function() {
$ionicBody.removeClass(self.viewType + '-open');
if (!modalStack.length) {
$ionicBody.removeClass(self.viewType + '-open');
}
self.el.classList.add('hide');
}, self.hideDelay || 320);
},
Expand Down

2 comments on commit 6ed7253

@VinceOPS
Copy link

@VinceOPS VinceOPS commented on 6ed7253 Dec 7, 2016

Choose a reason for hiding this comment

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

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

@shanesmith
Copy link
Contributor

Choose a reason for hiding this comment

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

Pull request opened to resolve this: ionic-team/ionic-v1#219

Please sign in to comment.