angular / angular/components

bug(select[matNativeControl]): Sometimes the options are not triggered

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

Description

### Is this a regression?

- [X] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

prior to mdc migration

### Description

when using `select[matNativeControl]` inside `` there's a couple of problems:

1. when using an empty string as the default option, the label appears within the form field. directly clicking the label does not trigger the options.
2. clicking just inside `mat-form-field` (inside the outline) also does not trigger the options

### Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-r49x2i?file=src%2Fapp%2Fexample-component.html
Steps to reproduce:
1. click the label while it's within the form field
2. also click just inside the bounds of the form field

### Expected Behavior

triggers the options

### Actual Behavior

options are not triggered - label just moves up

### Environment

- Angular: 16.1.2
- CDK/Material: 16.1.3
- Browser(s): chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and the interaction between select[matNativeControl] and mat-form-field appearance="outline". Reproduce the label and outline clicks, then verify that both trigger the options while preserving the expected label behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.