angular / angular/components

bug(form-field): remove hint wrapper when no hint provided

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

Even when no hint is provided, the hint-wrapper dom element still shows up.
This is because `mat-form-field-subscript-wrapper` has a margin as specified here:
```CSS
.mat-form-field-subscript-wrapper {
font-size: $subscript-font-size;
margin-top: $subscript-margin-top;
```

Screen Shot 2022-05-26 at 3 29 28 PM

### Reproduction

Steps to reproduce:
1. Add an outline material form field without any hint and inspect.
eg:
```HTML

Outline form field


```

### Expected Behavior

When no hint is being provided, the wrapper dom element shouldn't render.

### Actual Behavior

The wrapper renders and takes up space.

### Environment

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

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 tái hiện ví dụ outline mat-form-field được cung cấp và kiểm tra DOM được tạo ra, đặc biệt là phần tử mat-form-field-subscript-wrapper và khoảng cách của nó. Issue được hoàn thành khi một trường biểu mẫu không có hint không render wrapper đó và không còn khoảng trống không mong muốn.

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
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
68/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.