From e5984eebdd232ba327e51ba1f165787cec30a32c Mon Sep 17 00:00:00 2001 From: lvostinar Date: Thu, 22 Oct 2015 11:14:20 +0300 Subject: [PATCH] related to https://github.com/angular-ui/bootstrap/pull/2916 ; use tab just for navigation, do not select from list --- src/typeahead/typeahead.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index 10b7778cf7..c7ef733588 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -290,7 +290,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap return; } - evt.preventDefault(); + if (evt.which !== 9) evt.preventDefault(); if (evt.which === 40) { scope.activeIdx = (scope.activeIdx + 1) % scope.matches.length; @@ -300,11 +300,15 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap scope.activeIdx = (scope.activeIdx > 0 ? scope.activeIdx : scope.matches.length) - 1; scope.$digest(); - } else if (evt.which === 13 || evt.which === 9) { + } else if (evt.which === 13) { scope.$apply(function () { scope.select(scope.activeIdx); }); + } else if (evt.which === 9) { + resetMatches(); + scope.$digest(); + } else if (evt.which === 27) { evt.stopPropagation();