angular / angular/components

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

オープン
#24,855 コメント 1 件 リアクション 3 件 担当者 0 名 GitHub で見る
area: material/chips P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

### 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

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

- Angular:
- CDK/Material:
- Browser(s):
- Operating System (e.g. Windows, macOS, Ubuntu):

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされた StackBlitz の再現手順から始め、チップ入力の matChipInputAddOnBlur の動作とオートコンプリートの optionSelected イベントの相互作用を追跡してください。テキストを入力して orange をクリックするケースを確認し、クリックしたオプションが追加され、optionSelected が発火する一方で、入力した値が想定どおりに処理されることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。