angular / angular/components

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

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

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dalla riproduzione collegata su StackBlitz e confronta il suo comportamento con Angular 17 con la demo fornita della versione 14, tracciando nel frattempo i cambiamenti di stato del form-field di Angular Material. Riproduci il cambio dinamico del tipo di input e il flusso di submit; il lavoro è completato quando l’etichetta fluttua e il contorno del form riflette lo stato di errore dopo la modifica dell’input.

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à
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.