From 8f006260fb23f9a86a589701b9ed6f000f73f3fa Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 17 Dec 2015 15:58:55 -0600 Subject: [PATCH] fix(modal): popover and modal scroll fixes #4793 --- js/angular/service/modal.js | 7 +++++++ js/views/scrollViewNative.js | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/js/angular/service/modal.js b/js/angular/service/modal.js index 9b8db96a764..73ee83a2fd3 100644 --- a/js/angular/service/modal.js +++ b/js/angular/service/modal.js @@ -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)) { diff --git a/js/views/scrollViewNative.js b/js/views/scrollViewNative.js index 62d63cbbe73..e3595125c55 100644 --- a/js/views/scrollViewNative.js +++ b/js/views/scrollViewNative.js @@ -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; @@ -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