Skip to content

Commit 8f00626

Browse files
committed
fix(modal): popover and modal scroll fixes #4793
1 parent daf71c7 commit 8f00626

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

js/angular/service/modal.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
185185

186186
return $timeout(function() {
187187
if (!self._isShown) return;
188+
self.$el.on('touchmove', function(e) {
189+
//Don't allow scrolling while open by dragging on backdrop
190+
var isInScroll = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'scroll');
191+
if(!isInScroll) {
192+
e.preventDefault();
193+
}
194+
})
188195
//After animating in, allow hide on backdrop click
189196
self.$el.on('click', function(e) {
190197
if (self.backdropClickToClose && e.target === self.el && stack.isHighest(self)) {

js/views/scrollViewNative.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@
333333
var alreadyShrunk = self.isShrunkForKeyboard;
334334

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

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

0 commit comments

Comments
 (0)