0
votes

New to Angular and have been reading the Material documentation on mat-form-fields. I am having a weird bug happening when the form-field is focused. My mat-label disappears on focus and reappears once focus is lost.

This only appears to be happening in Chrome. Firefox and Edge do not have this bug

<mat-form-field>
    <mat-label>Days</mat-label>
    <mat-select value="{{pD.Days[0]}}" [(ngModel)]="pDSaveModel.Days" (ngModelChange)="saveModelChanged()">
        <mat-option *ngFor="let day of pD.Days" [value]="day">
            {{day}}
        </mat-option>
    </mat-select>
</mat-form-field>

Here is a screenshot of the form field out of focus

enter image description here

And here is the same field when focused

enter image description here

And here is the end result after losing focus

enter image description here

I have tried adding in placeholder="" to the mat-select, as well as trying different appearance options other than the default legacy. I have also tried using the floatLabel="always" property but with no luck. Any help is much appreciated !

1
I am unable to provide that as I am unfamiliar how to :(johnnyjohnson
Do you have errors in the console ?Alexandre
I have no errors in the consolejohnnyjohnson

1 Answers

0
votes

Changing the tags to something like a header tag ended up being a solution. I then just applied a simple class to make the font-weight normal.