This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.
Modal doesn't always close on outside click if browser is heavily loaded #5080
Closed
Description
It seems like #2280 accidentally changed the api of one of your calls. You registered click events outside the modal via ng-click before. However #2280 bugfix switched to using element.on('click') instead. This is not the same as the event handler may run outside of a digest cycle if the browser is heavily loaded.
Howevever looking at ng-click's code you can see it always wraps the click handlers with $apply.
https://github.com/angular/angular.js/blob/master/src/ng/directive/ngEventDirs.js#L61-L71
element.on(eventName, function(event) {
var callback = function() {
fn(scope, {$event:event});
};
if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
scope.$evalAsync(callback);
} else {
scope.$apply(callback);
}
});
I can't reproduce this in a plunker at it happens too randomly. However I haven't seen the issue reappear since wrapping the scope.close click handler with $apply.