Skip to content

Conversation

@lekhmanrus
Copy link
Contributor

When using MatChipInput with MatAutocomplete, pressing Enter after typing and selecting an autocomplete option caused two chips to be added - one from the typed text and one from the selected option.
This behavior did not occur when selecting with a mouse click.

This PR updates the chips input handling logic to ensure that only the selected autocomplete option is added when the user confirms the selection.

close #32204, #13574

@lekhmanrus lekhmanrus requested a review from a team as a code owner October 30, 2025 04:17
@lekhmanrus lekhmanrus requested review from andrewseguin and wagnermaciel and removed request for a team October 30, 2025 04:17
@lekhmanrus lekhmanrus force-pushed the fix/32204/material-chips-add-only-active-autocomplete-option-on-selection branch from 54f3573 to 372d20b Compare October 30, 2025 05:56
selector: 'input[matChipInputFor][matAutocomplete]',
exportAs: 'matChipInput, matChipInputFor',
})
export class MatChipAutocompleteInput extends MatChipInput {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be breaking for apps using standalone. Also I'm not sure it's the way to go since it means that apps which use chips will have to load the autocomplete too.

Couldn't we resolve it by adjusting the demo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(Chips Autocomplete): Selecting an option with Enter adds both input text and selected option as chips

2 participants