angular / angular/components

bug(Autocomplete): matAutocomplete with control initial value does not highlight value in options with check icon

Đang mở
#29,422 7 bình luận 13 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

A MatAutocomplete field initialized with a control value does not highlight item in options

### Reproduction

StackBlitz link: https://stackblitz.com/edit/saqfud?file=src%2Fexample%2Fautocomplete-filter-example.ts,src%2Fexample%2Fautocomplete-filter-example.html,src%2Fexample%2Fautocomplete-filter-example.css
Steps to reproduce:
1. Set initial value of control (second one value for example)
```
options: string[] = ['One', 'Two', 'Three'];
myControl = new FormControl(this.options[1]);
```
3. click on input on UI

### Expected Behavior

Second one option is highlighted
![image](https://github.com/angular/components/assets/60134428/1d2c8684-8dc5-42dc-8433-7051b02926f6)

### Actual Behavior

second option is not highlighted
![image](https://github.com/angular/components/assets/60134428/635ef0d6-bf94-4523-b8b3-38014f7c2356)

### Environment

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

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

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

Hướng nghiên cứu

Bắt đầu bằng cách chạy bản tái hiện StackBlitz được liên kết và kiểm tra src/example/autocomplete-filter-example.ts cùng src/example/autocomplete-filter-example.html. Xác nhận rằng có một giá trị được chọn ban đầu, nhưng tùy chọn tương ứng không được tô sáng khi mở ô nhập. Được xem là hoàn tất khi tùy chọn thứ hai được tô sáng nhất quán đối với giá trị FormControl ban đầu được cung cấp, kèm theo một bài kiểm thử hồi quy bao quát hành vi này.

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
38/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.