DatePicker does not trigger onChange when manually clearing input text
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- react, typescript
- 领域
- frontend
调研方向
从链接的 CodeSandbox 复现开始,比较手动删除与单选和范围选择器的清除按钮行为。完成标准是:清除输入会触发携带 null 的 onChange,输入在失焦后仍保持为空,并且在列出的选择器模式中保持该行为。
由索引模型根据 Issue 内容生成。
描述
Issue for react-component/picker
Title: DatePicker does not trigger onChange when manually clearing input text
🐛 Bug Report
rc-picker version: 4.11.3 (also affects latest versions)
📝 Description
When a user manually selects and deletes the date text in a Picker input field (by selecting all text and pressing delete/backspace), the onChange callback is not triggered. After the input loses focus (blur), the previous date value re-appears.
This behavior is inconsistent with:
- Clicking the clear button (which properly triggers
onChangewithnull) - User expectations (manual deletion should clear the value)
🔗 Related Issues
- ant-design/ant-design#52473
📦 Reproduction
Codesandbox: Link to reproduction
Steps to reproduce:
- Render a Picker with a value (e.g., "2023-08-01")
- Click in the input field
- Select all text (Ctrl+A / Cmd+A)
- Press Delete or Backspace to clear the text
- Click outside the input (trigger blur)
Expected behavior:
onChangeshould be called withnull- Input should remain empty
- Value should be cleared
Actual behavior:
onChangeis NOT called ❌- Input resets to the previous value ("2023-08-01")
- Value is not cleared
📋 Additional Context
This issue affects:
- ✅ Single date picker
- ✅ Range picker (both inputs)
- ✅ All picker modes (date, week, month, year, quarter, time)
Reopening this issue here recommend by @zombieJ
- 主要语言
- TypeScript
- 星标
- 304
- 派生
- 349
- 平均合并
- 43 分钟
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react-component/picker 的其他 Issue
-
Disabled date entered manually is not reverted on blur可能已有人在做 @Ye-YiChen 于 5 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
react-component/picker#1018 · 2 条评论 ·
-
enter date manually in format YY prevent the user to add YYYY可能已有人在做 @nrps9909 于 51 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 48/100
react-component/picker#956 · 1 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 30/100
react-component/picker#955 · 1 条评论 · 1 个 reaction ·
-
[Bug / DX]: Deep imports for generateConfig are incompatible with pnpm and break module resolution可能已有人在做 @DanielChutkowskiJMMJ 于 333 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 58/100
react-component/picker#949 ·
-
难度 3/5 1-2 天 新手友好度 45/100
react-component/picker#939 ·
查看 react-component/picker 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
umami-software/umami#4637 ·
维护者通常 3 天内回复
-
Hotkeys fire when pressed with the Ctrl key, so browser shortcuts also trigger player actions可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
muxinc/media-chrome#1332 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
polarsource/polar#15580 ·
维护者通常 1 天内回复
-
accepted bug via-triage
难度 2/5 1-3 小时 新手友好度 69/100
pingdotgg/t3code#20931 · 1 条评论 ·
维护者通常 1 天内回复
-
bug/1-unconfirmed kind/bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复