Skip to content

mat-select placeholder not working. #19514

Closed
livepoll/live-poll
#189
@KissBalazs

Description

@KissBalazs

🐞 bug report

Affected Package

Angular Material 9

Is this a regression?

Not sure.

Description

Using placeholder attribute has no effect in mat-select, if mat-label is provided also.

🔬 Minimal Reproduction

Forked from the mat-select example in the documentation:

https://stackblitz.com/edit/angular-qlpnim-vyfruq?file=src/app/select-overview-example.html

<h4>Basic mat-select</h4>
<mat-form-field>
  <mat-label>Favorite food</mat-label>
  <mat-select placeholder="No value selected">  <!-- this is not showing-->
    <mat-option *ngFor="let food of foods" [value]="food.value">
      {{food.viewValue}}
    </mat-option>
  </mat-select>
</mat-form-field>

Expected and Actual behavior.
Expected: If provided, the label floats to the top of the field, and the placeholder text can be seen if no value is selected.
Actual: the label acts as a placeholder.

🔥 Exception or Error

--

🌍 Your Environment

Angular Version:


@angular/material                  9.0.1

Anything else relevant?

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/select

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions