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

Commit

Permalink
fix(autocomplete): Allow clicks inside md-not-found.
Browse files Browse the repository at this point in the history
Fix bug causing the autocomplete to blur, lose focus, and
hide the not found message if the user attempted to click
the not found message (or a link inside of it).

Fixes #5424.
  • Loading branch information
topherfangio committed Nov 4, 2015
1 parent e778cdd commit 7c5723d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/autocomplete/js/autocompleteController.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
* Handles input blur event, determines if the dropdown should hide.
*/
function blur () {
hasFocus = false;
if (!noBlur) {
hasFocus = false;
ctrl.hidden = shouldHide();
}
}
Expand All @@ -370,7 +370,10 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
* @param forceBlur
*/
function doBlur(forceBlur) {
if (forceBlur) noBlur = false;
if (forceBlur) {
noBlur = false;
hasFocus = false;
}
elements.input.blur();
}

Expand Down Expand Up @@ -408,6 +411,9 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
updateMessages();
break;
case $mdConstant.KEY_CODE.TAB:
// If we hit tab, assume that we've left the list so it will close
onListLeave();

if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return;
select(ctrl.index);
break;
Expand Down

0 comments on commit 7c5723d

Please sign in to comment.