bug(material/chips): MatChipSelectionChange not emitting on certain deselections
- 主要言語
- 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
`selectionChange` output for `MatChipOption` is [stated to be](https://material.angular.io/components/chips/api#MatChipOption):
> Emitted when the chip is selected or **deselected**.
But this is not true for deselection. It appears the event is only emitted for deselection when **the chip in question** is manually selected/toggled by the user. When the `MatChipListbox` is **in single-select mode and a chip is currently selected**, selecting a different chip means the prior chip is deselected --> deselecting should mean emitting the `selectionChange` event, but it is not happening in this scenario.
See the below StackBlitz link.
### Reproduction
StackBlitz link: https://stackblitz.com/edit/firqg1
Steps to reproduce:
(First chip is initially selected)
1. Click on the Second chip.
2. First chip becomes deselected, but no `selectionChange` output event was emitted (in this case, the `MatChipSelectionChange` object should be logged to the console).
### Expected Behavior
`selectionChange` output for the First chip should have emitted.
### Actual Behavior
`selectionChange` output for the First chip does not emit.
### Environment
- Angular: 16
- CDK/Material: 16.2.7 (latest)
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
コントリビューションガイド
調査の方向性
リンクされた StackBlitz の再現例を開き、issue に記載されている MatChipOption と MatChipListbox の選択動作を確認します。2 番目のチップを選択したときの single-select の選択解除パスを検証します。1 番目のチップが選択解除された時点で MatChipSelectionChange イベントを発行すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- frontend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100