Skip to content

Chrome complaining about "illegal use of labels" #28184

Open
@matrium0

Description

@matrium0

Description

When using <mat-form-field> with <mat-select> and <mat-label> Chrome prints out the following warning:
Incorrect use of <label for=FORM_ELEMENT>

I assume this is a new check Chrome added in a recent versions to it's dev tools. Though I guess Angular Material should probably comply to those, if at all possible.

Reproduction

This can be easily reproduced, even on the Angular Material Page, e.g. on https://material.angular.io/components/form-field/overview (though it appears on any page that uses <mat-select> and <mat-label> within <mat-form-field>

image

Expected Behavior

No error should be displayed

Actual Behavior

Incorrect use of <label for=FORM_ELEMENT> is printed for each mat-label within a mat-form-field

Environment

  • Angular: 17.0.1
  • CDK/Material: 17.0.1
  • Browser(s): Chrome 117
  • Operating System: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/select

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions