Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 2570483

Browse files
committed
fix(typeahead): reset matches if enter is hit
- If no match is selected and enter is hit, reset matches Closes #4063 Fixes #3545
1 parent 7af9cdf commit 2570483

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Diff for: src/typeahead/typeahead.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,8 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
354354
return;
355355
}
356356

357-
// if there's nothing selected (i.e. focusFirst) and enter is hit, don't do anything
358-
if (scope.activeIdx === -1 && evt.which === 13) {
359-
return;
360-
}
361-
362-
// if there's nothing selected (i.e. focusFirst) and tab is hit, clear the results
363-
if (scope.activeIdx === -1 && evt.which === 9) {
357+
// if there's nothing selected (i.e. focusFirst) and enter or tab is hit, clear the results
358+
if (scope.activeIdx === -1 && (evt.which === 9 || evt.which === 13)) {
364359
resetMatches();
365360
scope.$digest();
366361
return;

0 commit comments

Comments
 (0)