angular / angular/components

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

Đang mở
#28,087 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: material/autocomplete P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Mở bản tái hiện StackBlitz được liên kết và kiểm tra src/auto-complete/auto-complete.component.html, sau đó theo dõi cách MatAutocomplete xử lý tiêu điểm khi tiêu điểm được thay đổi theo chương trình. Tái hiện luồng Ctrl+DownArrow và xác minh rằng việc di chuyển tiêu điểm bằng element.focus(), click() hoặc blur() sẽ đóng panel như mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.