Skip to content

Commit

Permalink
fix(modal): popover and modal scroll fixes #4793
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch committed Dec 17, 2015
1 parent daf71c7 commit 8f00626
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions js/angular/service/modal.js
Expand Up @@ -185,6 +185,13 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl

return $timeout(function() {
if (!self._isShown) return;
self.$el.on('touchmove', function(e) {
//Don't allow scrolling while open by dragging on backdrop
var isInScroll = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'scroll');
if(!isInScroll) {
e.preventDefault();
}
})
//After animating in, allow hide on backdrop click
self.$el.on('click', function(e) {
if (self.backdropClickToClose && e.target === self.el && stack.isHighest(self)) {
Expand Down
3 changes: 2 additions & 1 deletion js/views/scrollViewNative.js
Expand Up @@ -333,6 +333,7 @@
var alreadyShrunk = self.isShrunkForKeyboard;

var isModal = container.parentNode.classList.contains('modal');
var isPopover = container.parentNode.classList.contains('popover');
// 680px is when the media query for 60% modal width kicks in
var isInsetModal = isModal && window.innerWidth >= 680;

Expand All @@ -352,7 +353,7 @@
// shrink scrollview so we can actually scroll if the input is hidden
// if it isn't shrink so we can scroll to inputs under the keyboard
// inset modals won't shrink on Android on their own when the keyboard appears
if ( ionic.Platform.isIOS() || ionic.Platform.isFullScreen || isInsetModal ) {
if ( !isPopover && (ionic.Platform.isIOS() || ionic.Platform.isFullScreen || isInsetModal) ) {
// if there are things below the scroll view account for them and
// subtract them from the keyboard height when resizing
// E - D E D
Expand Down

0 comments on commit 8f00626

Please sign in to comment.