angular / angular/components

but(FormFiled): Floating label hide/show not responsive when set to outline appearance.

Ouverte
#29,939 7 commentaires 0 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

When you have a mat form field and the mat-label is conditional. If the view starts with the label and gets remove with @if in template it is perfectly fine. Will disappear and reappear. If the view starts with-out the mat label rendered, the label will get rendered but the component, 'MatFormFieldNotchedOutline" still has the class, 'mdc-notched-outline--no-label', so the display is set to none.

Looks as though if the mat-label is not there on view init it is not responsive.

The behavior works fine with fill appearance.

### Reproduction

StackBlitz link:
Steps to reproduce:
1.
2.

### Expected Behavior

When mat-label gets rendered in even after init, i.e. Using a structural directive or decorator such *ngIf or @if. The label should show no matter the appearance.

### Actual Behavior

When you have the appearance set to outline and the view is initially rendered without the label it is not responsive and will not show up.

### Environment

- Angular: 18.2.10
- CDK/Material: 18.2.10
- Browser(s): Edge, Chrom
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par le comportement de MatFormFieldNotchedOutline pour l’apparence outline et reproduisez un mat-label rendu conditionnellement avec @if après l’initialisation. C’est terminé lorsque l’outline ne conserve plus l’état sans label et que le label apparaît lorsqu’il est ajouté, conformément au comportement fill existant.

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é
À l'abandon
Clarté
À clarifier
Accessibilité débutants
38/100

Recevez les nouvelles issues par e-mail

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