angular / angular/components

bug(MatSelect): When navigating with keyboard, sometimes the first press of the down arrow is "ignored"

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

Description

#### Reproduction

The value of the first `MatOption` in a `MatSelect` must be `null`. Example:
```

-- // <------- Here
Dog
Cat

```

- https://stackblitz.com/edit/angular-lyemh3?file=src%2Fapp%2Fselect-hint-error-example.html

Steps to reproduce:
1. Refresh development server
2. Tab to the `MatSelect`
2. Use the down arrow to make a selection
3. Notice that the very first press appears to be ignored

#### Expected Behavior

The first press of the arrow should select `Dog`.

#### Actual Behavior

The first press of the arrow appears to do nothing.

#### Environment

- Angular: 11.0.6
- CDK/Material: 11.0.3
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior in the linked StackBlitz with a MatSelect whose first MatOption has a null value, then trace the MatSelect keyboard-navigation path. Done means the first Down Arrow press selects Dog rather than appearing ignored, with a regression test covering this case.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.