Skip to content

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 angular#5424.
  • Loading branch information
topherfangio authored and ThomasBurleson committed Nov 6, 2015
1 parent 61411a3 commit 5ae3d4c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/autocomplete/js/autocompleteController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 5ae3d4c

Please sign in to comment.