Skip to content

mat-select placeholder not working. #19514

Closed
livepoll/live-poll
#189

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?

Activity

  1. self-assigned this
    on Jun 2, 2020
  2. added
    P3
    on Jun 2, 2020
  3. added a commit that references this issue on Jun 2, 2020
    2711a6a
  4. added 2 commits that reference this issue on Sep 28, 2020
    ba74a58
    2a6d2c8
  5. added a commit that references this issue on Oct 12, 2020
    6c9e594
  6. added 2 commits that reference this issue on Mar 10, 2021
    7a972fb
    77b6a6d
  7. angular-automatic-lock-bot commented on Apr 10, 2021

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3area: material/select

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions