angular / angular/components

bug(Autocomplete): matAutocomplete with control initial value does not highlight value in options with check icon

オープン
#29,422 コメント 7 件 リアクション 13 件 担当者 0 名 GitHub で見る
area: material/autocomplete 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

A MatAutocomplete field initialized with a control value does not highlight item in options

### Reproduction

StackBlitz link: https://stackblitz.com/edit/saqfud?file=src%2Fexample%2Fautocomplete-filter-example.ts,src%2Fexample%2Fautocomplete-filter-example.html,src%2Fexample%2Fautocomplete-filter-example.css
Steps to reproduce:
1. Set initial value of control (second one value for example)
```
options: string[] = ['One', 'Two', 'Three'];
myControl = new FormControl(this.options[1]);
```
3. click on input on UI

### Expected Behavior

Second one option is highlighted
![image](https://github.com/angular/components/assets/60134428/1d2c8684-8dc5-42dc-8433-7051b02926f6)

### Actual Behavior

second option is not highlighted
![image](https://github.com/angular/components/assets/60134428/635ef0d6-bf94-4523-b8b3-38014f7c2356)

### Environment

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

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

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

調査の方向性

まず、リンクされた StackBlitz の再現手順を実行し、src/example/autocomplete-filter-example.ts と src/example/autocomplete-filter-example.html を確認します。初期選択された値は存在するものの、入力欄を開いたときにそのオプションがハイライトされないことを確認します。提供された初期 FormControl 値に対して 2 番目のオプションが一貫してハイライトされ、この動作をカバーする回帰テストがあれば完了です。

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

評価

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

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

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