angular / angular/components

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

Aperta
#24,980 7 commenti 18 reazioni 0 assegnatari Vedi su GitHub
area: material/form-field P4
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo l’esempio outline mat-form-field fornito e ispeziona il DOM generato, in particolare l’elemento mat-form-field-subscript-wrapper e il relativo spazio. L’issue è completata quando un campo del modulo senza hint non esegue il rendering di quel wrapper e non rimane spazio indesiderato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
68/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.