Skip to content

bug(mat chips): mat-chips with mat-autocomplete and input combined, adds an extra chip when selecting from list #19805

@elazarza

Description

@elazarza

Reproduction

stackblitz demo:
https://components-issue-eyb6jo.stackblitz.io

Steps to reproduce:

  1. create mat chips as shown in the example section in the docs
  2. use the autocomplete example
  3. add the Input example neccessary parts - [matChipInputAddOnBlur]="addOnBlur" in template and addBlur= true in TS
  4. start typing one of the items in the autocomplete, i.e: Apple - start typing Ap, then click Apple

Expected Behavior

What behavior were you expecting to see?

only the item Apple is added to the chips list and the input is cleared

Actual Behavior

What behavior did you actually see?

both "Ap" that is the input value at the moment and "Apple" that is the clicked item are added to the chips list

Environment

  • Angular: 8.2.3
  • CDK/Material: cdk - 7.3.7 material - 7.0.1
  • Browser(s): tested on Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions