Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit a4732a9

Browse files
authored
fix(autocomplete): prevent flashing of invalid state (#12064)
- when user clicks on suggestion, input element lost focus and then programmatically get focused - again, add stop immediate propagation to prevent blur event handling by other handlers which - update ng-model validity state - add check that the event is an object Fixes #10975
1 parent 7d5e262 commit a4732a9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/components/autocomplete/js/autocompleteController.js

+3
Original file line numberDiff line numberDiff line change
@@ -598,13 +598,16 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
598598

599599
/**
600600
* Handles input blur event, determines if the dropdown should hide.
601+
* @param {Event=} $event
601602
*/
602603
function blur($event) {
603604
hasFocus = false;
604605

605606
if (!noBlur) {
606607
ctrl.hidden = shouldHide();
607608
evalAttr('ngBlur', { $event: $event });
609+
} else if (angular.isObject($event)) {
610+
$event.stopImmediatePropagation();
608611
}
609612
}
610613

0 commit comments

Comments
 (0)