adobe / adobe/react-spectrum

DateField: onChange not called on blur when date is invalid or incomplete

Open
#9,624 10 comments 3 reactions 0 assignees View on GitHub
DateField waiting
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

According to https://github.com/adobe/react-spectrum/pull/9510, invalid or incomplete date values should not be emitted via onChange while typing, but should be emitted when the user blurs the field.
However, when the user blurs the field with an invalid or incomplete date, onChange is not called at all.

### 🤔 Expected Behavior?

- User enters valid date.
- User removes one of the segment (date become invalid)
- User blurs from the field
- onChange is called.

### 😯 Current Behavior

- User enters valid date.
- User removes one of the segment (date become invalid)
- User blurs from the field
- onChange is not called.

### 💁 Possible Solution

_No response_

### 🔦 Context

_No response_

### 🖥️ Steps to Reproduce

Add console log to `onChange` to TimeField example in https://react-aria.adobe.com/TimeField and test repro steps above, or use this link: https://stackblitz.com/edit/hazsexms-xrw2sxau?file=src%2FExample.tsx

### Version

1.15.0

### What browsers are you seeing the problem on?

Chrome

### If other, please specify.

_No response_

### What operating system are you using?

macOS Tahoe

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.