DatePicker: Clear button should still clear the input when a date is partially filled out
- Dominant language
- TypeScript
- Stars
- 15.9k
- Forks
- 1.6k
- Avg merge
- 3d 9m
- Merged PRs (30d)
- 59
Description
### Provide a general summary of the issue here
When clicking the clear button on a partially filled-out DatePicker, the date text box does not clear.
### 🤔 Expected Behavior?
I would expect the date to still clear
### 😯 Current Behavior
The date does not clear
### 💁 Possible Solution
The clear button sets the date to null, but if there is no date yet (a partially filled out date is invalid, so no date has been set) then this method won't work. Instead, the `DatePickerStateContext` could be modified to clear the underlying text.
### 🔦 Context
_No response_
### 🖥️ Steps to Reproduce
https://github.com/user-attachments/assets/ade76e28-a812-4ced-9a0b-ee493f72d703
(example used: https://react-spectrum.adobe.com/react-aria/DatePicker.html#state, the date does not clear)
### Version
1.13.0
### What browsers are you seeing the problem on?
Chrome
### If other, please specify.
_No response_
### What operating system are you using?
Windows 11
### 🧢 Your Company/Team
_No response_
### 🕷 Tracking Issue
_No response_
Contributor guide
Research direction
Start with the DatePickerStateContext mentioned in the issue and reproduce the behavior using the React Aria DatePicker state example in Chrome. Trace how the clear button handles a partially filled, invalid date and verify that the underlying text is cleared as well as the date state. Done means the clear button empties the input even when no complete date has been set.
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
- 45/100