angular / angular/components

bug(CdkListbox): cdkOption requires additional event to rerender after list of options changed

オープン
#28,828 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: cdk/listbox 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 any **option was selected** in the list and than user filtered them somehow and back to the initial list, **that selected option** will be rendered incorrectly.

https://github.com/angular/components/assets/13451032/4392054a-68e3-439e-a250-0084c943d37d

P.S. A bit similar problem was there: https://github.com/angular/components/issues/28557

### Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-xvgkha?file=src%2Findex.html,src%2Fmain.ts
Steps to reproduce:
1. Click **"Ron"** option (it becomes true)
2. Type in `input` letter **"J"**
3. Remove letter **"J"**
4. See that option **"Ron"** is false.
5. Type in input letter **"R"** or click outside `input`
6. See that option **"Ron"** is true.

### Expected Behavior

Option should be rendered immediately based on its internal state (`isSelected()/isActive()`).

### Actual Behavior

Option requires one more event to be rendered based on its internal state (`isSelected()/isActive()`).

### Environment

- Angular: 17
- CDK/Material: 17.3.3
- Browser(s): Chrome and Safari
- Operating System (e.g. Windows, macOS, Ubuntu):

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

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

調査の方向性

リンクされた StackBlitz の再現環境から始め、特に src/index.html と src/main.ts を確認し、CdkListbox と cdkOption のフィルタリング手順を追ってください。リストが初期内容に戻った後の、選択されたオプションのレンダリング状態を比較してください。別の入力イベントやフォーカスイベントを必要とせず、オプションが内部の isSelected()/isActive() 状態から直ちにレンダリングされれば完了です。

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

評価

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

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

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