MatAutocomplete panel does not close when the parent input changes focus programmatically.
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 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