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();