angular / angular/components

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

Ouverte
#24,980 7 commentaires 18 réactions 0 personnes assignées Voir sur GitHub
area: material/form-field P4
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par reproduire l’exemple outline mat-form-field fourni et inspectez son DOM généré, en particulier l’élément mat-form-field-subscript-wrapper et son espacement. L’issue est terminée lorsqu’un champ de formulaire sans hint ne rend pas ce wrapper et qu’il ne reste aucun espace indésirable.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
68/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.