Disable scrolling through ionicModal on iOS?

I’m seeing a bug only on iOS where I am able to scroll the content in the background when a modal is displayed. This occurs whether I am dragging in the area outside the modal, or if I drag the modal itself. I tried toggling $ionicScrollDelegate.freezeAllScrolls when a modal is shown/hidden, but that had no effect.

Is there some way to prevent scrolling while the modal is shown?

Bump. Also seeing this. Only happens on iOS

I managed to get around it with this bit of code:

// disable scrolling on modal open to fix ios background-scrolling issue
$rootScope.$on('modal.shown', function() {
  $('.overflow-scroll').css('overflow-y', 'hidden');
});
// re-enable scrolling on close
$rootScope.$on('modal.hidden', function() {
  $('.overflow-scroll').css('overflow-y', 'scroll');
});

Seems super hacky, but it gets the job done.

AH! this is interesting. Basically if you set overflow-scroll="true" then scroll is not getting disabled when modal is opened on iOS

1 Like