diff --git a/src/material/chips/chip-input.ts b/src/material/chips/chip-input.ts index 68b590bc9882..d61ee09b85d1 100644 --- a/src/material/chips/chip-input.ts +++ b/src/material/chips/chip-input.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {BACKSPACE, hasModifierKey} from '@angular/cdk/keycodes'; +import {BACKSPACE, ENTER, hasModifierKey} from '@angular/cdk/keycodes'; import { AfterContentInit, Directive, @@ -167,6 +167,10 @@ export class MatChipInput implements MatChipTextControl, AfterContentInit, OnCha this._chipGrid._focusLastChip(); event.preventDefault(); return; + } else if (event.keyCode === ENTER) { + // Prevent adding both the search string and the selected suggestion + event.preventDefault(); + return; } else { this._focusLastChipOnBackspace = false; }