angular / angular/components

bug(MatDatePicker): change events emitted despite using emitEvents false

Open
#20,218 22 comments 34 reactions 0 assignees View on GitHub
area: material/datepicker needs: discussion P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Reproduction

https://stackblitz.com/edit/components-issue-xay9ty?file=src%2Fapp%2Fexample-component.ts

1. Click the "emitEvent: false" button

#### Expected Behavior

`valueChanges` should not emit values when setting a value with `emitEvent: false`

This works correctly for "normal" input components, but not when attaching a date picker.

The reproduction includes a text input and a select for comparison.

#### Actual Behavior

Using `setValue` or `patchValue` with `emitEvent` set to `false` has the `valueChanges` observable emit changes.

#### Environment

- Angular: 10.0.3
- CDK/Material: 10.0.3
- Browser: Chrome
- Operating System: Windows

Contributor guide

Open the contributing guide

Research direction

Open the linked StackBlitz reproduction and inspect src/app/example-component.ts. Click the "emitEvent: false" button, compare the date-picker behavior with the text input and select, and trace the valueChanges emissions. Done means setValue and patchValue with emitEvent: false produce no valueChanges emissions for the date picker.

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.