angular / angular/components

bug(Chips): Selecting value from autocomplete by keyboard navigation causes both the search string and the selected option to be added

Open
#28,852 2 comments 2 reactions 0 assignees View on GitHub
area: material/chips P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

Reproducible on this [example](https://material.angular.io/components/chips/overview#chips-autocomplete).

### Reproduction

StackBlitz link: https://stackblitz.com/edit/rd9usi?file=package.json
Steps to reproduce:
1. Type any input that is a substring of any item in the suggestion list
2. Navigate to a suggestion with keyboard
3. Press Enter
4. Both the search string and the selected are added

### Expected Behavior

Only the selected suggestion is added

### Actual Behavior

Both the selected and the suggested values are added

### Environment

- Angular: 16.2.6
- CDK/Material: 16.2.8
- Browser(s): Google Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): darwin arm64

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction, including package.json, and compare its behavior with the Chips autocomplete example. Trace keyboard navigation and Enter handling for a typed substring, then verify that only the selected suggestion is added and the search string is not also added.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.