react-component / react-component/picker

DatePicker does not trigger onChange when manually clearing input text

Open
#946 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
304
Forks
345
Avg merge
2d 7h
Merged PRs (30d)
7

Description

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 onChange with null)
  • User expectations (manual deletion should clear the value)
🔗 Related Issues
  • ant-design/ant-design#52473
📦 Reproduction

Codesandbox: Link to reproduction

Steps to reproduce:

  1. Render a Picker with a value (e.g., "2023-08-01")
  2. Click in the input field
  3. Select all text (Ctrl+A / Cmd+A)
  4. Press Delete or Backspace to clear the text
  5. Click outside the input (trigger blur)

Expected behavior:

  • onChange should be called with null
  • Input should remain empty
  • Value should be cleared

Actual behavior:

  • onChange is 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproduction and compare manual deletion with the clear-button behavior for single and range pickers. Done means clearing the input triggers onChange with null, keeps the input empty after blur, and preserves the behavior across the listed picker modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.