angular / angular/components

bug(datepicker): monthSelected doesn't actually update formControl if calendar view closed before picking a date in the month

未关闭
#30,463 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area: material/datepicker P4
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### Is this a regression?

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

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

_No response_

### Description

When opening a 'monthView' and closing a calendar in monthSelected event, pre-setting formControl value, its actually not changed. Its visible from the example I attached

### Reproduction

StackBlitz link: https://stackblitz.com/edit/c5ckw68f?file=src%2Fexample%2Fdatepicker-views-selection-example.html,src%2Fexample%2Fdatepicker-views-selection-example.ts,src%2Fexample%2Fdatepicker-views-selection-example.css
Steps to reproduce:
1. Select a different month in the calendar
2. Check the output values

### Expected Behavior

formControl value has a selected month

### Actual Behavior

formControl value doesn't change

### Environment

- Angular: 19.1.3
- CDK/Material: 19.1.3
- Browser(s): Chrome (all basically)
- Operating System: Windows

贡献指南

打开贡献指南

调研方向

从 StackBlitz 复现开始,尤其是 src/example/datepicker-views-selection-example.html 和 src/example/datepicker-views-selection-example.ts,并通过在 monthSelected 事件中关闭日历来复现 monthView 流程。跟踪 datepicker 的 form-control 更新路径,并验证选择月份后,在日历关闭之后 formControl 仍保留所选月份。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。