Skip to content

bug(form-field): mat-label disappears when density < -1 #26579

@eLarocque

Description

@eLarocque

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

Hi,
There seems to be an issue where the mat-labels disappear when the density of form-field is set to lower than -1. I don't think this is as designed...

Reproduction

Steps to reproduce:

  1. Set the density option to anything lower than -1, ex: @include mat.form-field-density(-2);
  2. Include a mat-form-field with the appearance set to "fill", with a mat-label

notice the labels do not appear. (Their css is set as "display:none;")

Demo: https://stackblitz.com/edit/angular-wvlwej
In the stackblitz, you can see that the labels appear fine when density is set at >= -1, but anything lower and the label is hidden.

image

Expected Behavior

The labels should be visible

Actual Behavior

The labels are not visible

Environment

  • Angular: 15.1.3
  • CDK/Material: 15.1.3
  • Browser(s): Chrome Version 109.0.5414.120
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2The issue is important to a large percentage of users, with a workaroundarea: material/form-field

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions