Skip to content

Selecting reset option in mat-select #10675

@RandomNonameDude

Description

@RandomNonameDude

Bug, feature request, or proposal:

When undefined (reset) option is selected in mat-select, and you open the options list and select the undefined option again, both valueChange and ngModelChange events are fired. When you do the same with non-undefined option, none of the events is fired.

What is the expected behavior?

I would expect undefined options to behave same as non-undefined ones, i. e. not to fire an event when the same option is selected twice.

What is the current behavior?

See above.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-hbmfjn-wk5qdh

Small example in Stackblitz. Undefined option is set as default. Try opening the options list and select the undefined (None) option again. You can see that both valueChange and ngModelChange events are fired (see the timestamps below the mat-select).

You can try selecting any non-undefined option twice and observe the timestamps. You will see that the events are fired only once (after the first selection), but not again when you select the same option for the second time.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Issue occurs in both Chrome and IE on Win7. Not tested anywhere else.

Is there anything else we should know?

Probably not.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/select

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions