angular / angular/components

bug(matFormField): Form field state not being updated properly when input dynamically changes

Đang mở
#28,495 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: material/form-field 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?

- [x] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

version 14

### Description

When dynamically changing the input type of a form field, the label and error state of the for field is not properly reflected, the label will not float up and the form outline color will not be set. [See demo example](https://stackblitz.com/edit/nmqf81?file=src%2Fexample%2Fform-field-hint-example.html)

Confirmed that id used to work properly in version 14 [see demo working](https://stackblitz.com/edit/vaqmlj?file=src%2Fapp%2Fform-field-overview-example.ts,src%2Fapp%2Fform-field-overview-example.html)

### Reproduction

Steps to reproduce:
1. open [demo](https://stackblitz.com/edit/nmqf81?file=src%2Fexample%2Fform-field-hint-example.html)
2. toggle slider
3. click submit
4. see that label has not floated and form outline is not red
5. open v14 demo and see it working properly [stackblitz](https://stackblitz.com/edit/vaqmlj?file=src%2Fapp%2Fform-field-overview-example.ts,src%2Fapp%2Fform-field-overview-example.html)

### Expected Behavior

Form field should allow inputs to dynamically change

### Actual Behavior

Error state and label are not propely reflected

### Environment

- Angular: 17
- CDK/Material: 17

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

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

Hướng nghiên cứu

Bắt đầu với bản tái hiện StackBlitz được liên kết và so sánh hành vi của bản này trên Angular 17 với demo version 14 được cung cấp, đồng thời theo dõi các thay đổi trạng thái của Angular Material form-field. Tái hiện việc chuyển đổi động của input-type và luồng submit; hoàn tất khi label nổi lên và viền của form phản ánh trạng thái lỗi sau khi input thay đổ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
35/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.