angular / angular/components

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

未关闭
#24,980 7 条评论 18 个 reaction 已指派 0 人 在 GitHub 查看
area: material/form-field P4
主要语言
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

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

贡献指南

打开贡献指南

调研方向

首先复现所提供的 outline mat-form-field 示例,并检查其生成的 DOM,尤其是 mat-form-field-subscript-wrapper 元素及其间距。当不带 hint 的表单字段不渲染该 wrapper 且不再有不必要的空白时,issue 即完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。