From 20d567f81c1dcdb537d7acf83a7afae7961e8286 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Mon, 15 Sep 2014 00:00:59 -0500 Subject: [PATCH] fix(click): remove native click prevent 400ms later When an actionsheet/popup is open, everything under it has `pointer-events:none`. However, once they are removed then the click prevent was removed immediately too, but the click that comes in 300ms later was still firing whatever would have been underneath the actionsheet/popup. Instead, wait 400ms before removing the click prevent, which would block the native click. Closes #2204 --- js/angular/service/actionSheet.js | 6 +++++- js/angular/service/popup.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/js/angular/service/actionSheet.js b/js/angular/service/actionSheet.js index 17eabd26e67..867fe2e51b1 100644 --- a/js/angular/service/actionSheet.js +++ b/js/angular/service/actionSheet.js @@ -119,7 +119,11 @@ function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicP scope.removed = true; sheetEl.removeClass('action-sheet-up'); - $ionicBody.removeClass('action-sheet-open'); + $timeout(function(){ + // wait to remove this due to a 300ms delay native + // click which would trigging whatever was underneath this + $ionicBody.removeClass('action-sheet-open'); + }, 400); scope.$deregisterBackButton(); stateChangeListenDone(); diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index 96adc248a85..3c3421be839 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -398,7 +398,11 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB previousPopup.show(); } else { //Remove popup-open & backdrop if this is last popup - $ionicBody.removeClass('popup-open'); + $timeout(function(){ + // wait to remove this due to a 300ms delay native + // click which would trigging whatever was underneath this + $ionicBody.removeClass('popup-open'); + }, 400); $ionicBackdrop.release(); ($ionicPopup._backButtonActionDone || angular.noop)(); }