angular / angular/components

Chrome complaining about "illegal use of labels"

Open
#28,184 2 comments 1 reaction 0 assignees View on GitHub
area: material/select P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Description

When using `` with `` and `` Chrome prints out the following warning:
**`Incorrect use of `**

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 `` and `` within ``

![image](https://github.com/angular/components/assets/36888285/0d444ad5-98a6-470f-99d8-b2d0e6a31c3a)

### Expected Behavior

No error should be displayed

### Actual Behavior

**Incorrect use of ``** 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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the warning on the Angular Material form-field overview page with mat-form-field, mat-select, and mat-label, then trace how those components render their label association. Done means Chrome no longer reports incorrect use of the label for attribute in this scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.