diff --git a/src/typeahead/typeahead.directive.ts b/src/typeahead/typeahead.directive.ts index 3e7398ad99..769ca082a9 100644 --- a/src/typeahead/typeahead.directive.ts +++ b/src/typeahead/typeahead.directive.ts @@ -217,8 +217,8 @@ export class TypeaheadDirective implements OnInit, OnDestroy { return; } - // enter - if (e.keyCode === 13) { + // enter, tab + if (e.keyCode === 13 || e.keyCode === 9) { this._container.selectActiveMatch(); return; @@ -249,12 +249,19 @@ export class TypeaheadDirective implements OnInit, OnDestroy { return; } - // if items is visible - prevent form submition + // if an item is visible - prevent form submission if (e.keyCode === 13) { e.preventDefault(); return; } + + // if an item is visible - don't change focus + if (e.keyCode === 9) { + e.preventDefault(); + + return; + } } changeModel(match: TypeaheadMatch): void {