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

fix(typeahead): reset matches if enter is hit #4063

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/typeahead/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,8 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
return;
}

// if there's nothing selected (i.e. focusFirst) and enter is hit, don't do anything
if (scope.activeIdx === -1 && evt.which === 13) {
return;
}

// if there's nothing selected (i.e. focusFirst) and tab is hit, clear the results
if (scope.activeIdx === -1 && evt.which === 9) {
// if there's nothing selected (i.e. focusFirst) and enter or tab is hit, clear the results
if (scope.activeIdx === -1 && (evt.which === 9 || evt.which === 13)) {
resetMatches();
scope.$digest();
return;
Expand Down