angular / angular/components

MatAutocomplete panel does not close when the parent input changes focus programmatically.

オープン
#28,087 コメント 3 件 リアクション 0 件 担当者 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

When adding host listener for keyboard navigation to other elements, the auto complete panel does not close.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/angular-14-material-fbxecy?file=src%2Fauto-complete%2Fauto-complete.component.html
Steps to reproduce:
1. Click in the "Number" input.
2. Press Ctrl+DownArrow.
3. Observe that focus moves to the text area input without closing the panel.

### Expected Behavior

After the focus of the parent input moves to another element (either by click() or blur()), the panel should be closed.

### Actual Behavior

After moving focus from the parent input by using element.focus() the auto complete panel keeps visible until a click action takes place.

### Environment

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

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

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

調査の方向性

リンクされたStackBlitzの再現を開き、src/auto-complete/auto-complete.component.htmlを調べます。次に、プログラムによるフォーカス変更に対するMatAutocompleteのフォーカス処理を追跡します。Ctrl+DownArrowのフローを再現し、element.focus()、click()、またはblur()でフォーカスを移動すると、期待どおりパネルが閉じることを確認します。

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

評価

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

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

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