angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.33k stars 6.73k forks source link

bug(CHIPS AUTOCOMPLETE): chips autocomplete won't emit optionSelected if matChipInputAddOnBlur is set to true #24855

Open WellingtonLopesJ opened 2 years ago

WellingtonLopesJ commented 2 years ago

Is this a regression?

The previous version in which this bug was not present was

No response

Description

When creating a mat autocomplete with chips the selectedOption event is not fired if the input associated with the chip-list has the [matChipInputAddOnBlur] property set as true and has a value typed in.

if you set the matChipInputAddOnBlur to false it will work perfectly, but I also need it to fire on blur to validate or insert the inputted value.

Reproduction

Steps to reproduce:

  1. visit https://stackblitz.com/edit/angular-rmuzjg-t8dcn6?file=src/app/chips-autocomplete-example.ts
  2. type "a" into the input
  3. click orange (or any other option except apple)

there is a console.log('selected') in the function associated with the (optionSelected) event, it won't be fired.

Expected Behavior

The option clicked (orange) should be added to the chips.

The autocomplete's optionSelected event should be fired.

Actual Behavior

a chip with the value inputted is added to the chips but the option clicked is not.

the autocomplete's optionSelected event is not fired.

Environment

Yura13 commented 4 months ago

I have the same problem. When will the bug be fixed?