-
Notifications
You must be signed in to change notification settings - Fork 3.4k
md-autocomplete freezes UI when removed while loading items. #8358
Comments
I tried updating your codepen to 1.1.0-rc3, the issue is definitely still around.
After a closer look with the dev tools, it seems that in the autocomplete controller I'm fairly confident I've narrowed down the bug to one of the following two places. The other possibility is that |
It seems like var isScrollDisabled = false;
function disableScroll() {
// Abort if isScrollDisabled?
isScrollDisabled = true;
$mdUtil.disableScrollAround();
}
function enableScroll() {
// Check if isScrollDisabled?
isScrollDisabled = false;
$mdUtil.enableScrolling();
} Then you would just replace the respective mdUtil scroll functions with these replacements that track the state... |
I've dug around on this a little more today after getting angular material to build and I think I have a cursory understanding of the problem. It looks like One solution is to have a flag and to not call that method if the scope has been destroyed... Note that I think we might also be able to consider this is bug in
|
Hi, I think this is related: function selectedItemChange(user) {
$location.url('/users/' + user.id);
} When the page changes the $scope.$on('$destroy', $mdUtil.enableScrolling); |
Yeah, I'm guessing that it is related. It sounds like similar circumstances for when we saw this bug on our team. Our current workaround is to decorate /**
* Decorate the angular-material util service to fix the md-mask bug.
* TODO(team): remove this when angular-material fixes this bug.
* @param {!angular.$provide} $provide
* @ngInject
*/
var duckPunch$mdUtil = function($provide) {
/**
* @param {!Object<string, function(...)>} $delegate
* @param {!angular.Scope} $rootScope
* @param {!angular.$timeout} $timeout
* @return {!Object<string, function(...)>}
* @ngInject
*/
var decorate$mdUtil = function($delegate, $rootScope, $timeout) {
$delegate.nextTick = function(callback, digest, scope) {
//-- grab function reference for storing state details
var nextTick = $delegate.nextTick;
var timeout = nextTick.timeout;
var queue = nextTick.queue || [];
//-- add callback to the queue
queue.push({scope: scope, callback: callback});
//-- set default value for digest
if (digest == null) digest = true;
//-- store updated digest/queue values
nextTick.digest = nextTick.digest || digest;
nextTick.queue = queue;
//-- either return existing timeout or create a new one
return timeout || (nextTick.timeout = $timeout(processQueue, 0, false));
/**
* Grab a copy of the current queue
* Clear the queue for future use
* Process the existing queue
* Trigger digest if necessary
*/
function processQueue() {
var queue = nextTick.queue;
var digest = nextTick.digest;
nextTick.queue = [];
nextTick.timeout = null;
nextTick.digest = false;
queue.forEach(function(queueItem) {
var skip = queueItem.scope && queueItem.scope.$$destroyed;
if (!skip) {
queueItem.callback();
}
});
if (digest) $rootScope.$digest();
}
};
return $delegate;
};
$provide.decorator('$mdUtil', decorate$mdUtil);
};
var app = angular.module('Application', [
'ngMaterial',
...
]).config(duckPunch$mdUtil); of course, normal injection rules apply (we use the closure-compiler, so the |
There are a number of other issues which seem to be related, but they're all closed:
#7634
#3287
#3334
#3371 <--- closest that I can figure...
Actual behavior:
.md-scroll-mask
persists and eats mouse/keyboard events making the UI seem unresponsive..md-scroll-mask
should go away when the autocomplete does...CodePen or Steps to reproduce the issue: *
.md-scroll-mask
Angular Versions: *
Additional Information:
Shortcut to create a new CodePen Demo.
Note:
*
indicates required information. Without this information, your issue may be auto-closed.The text was updated successfully, but these errors were encountered: