-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Provide a general summary of the issue here
We use zod schema validation for our forms and use the NumberField component within our forms. The validation happens onSubmit and on an object built like this: Object.fromEntries(new FormData(e.currentTarget))
What we observe with all React Aria Components, is that the onBlur event checks wether the field is "dirty", and if so, the component removes the [data-invalid] attribute. The number field acts different, it always removes the [data-invalid] attribute "onBlur", because it seems to think the value is "dirty" even when the value hasn't changed.
🤔 Expected Behavior?
Only remove the [data-invalid] attribute "onBlur" when value is dirty.
😯 Current Behavior
Remove [data-invalid] attribute on any "onBlur" event. (even if field is not dirty).
💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
<Form
validationErrors={{testNumber: "foo-bar error!"}}
>
<NumberField name="testNumber">
<Label>Test Number</Label>
<Input />
<FieldError />
</NumberField>
<Button type="submit" />
</Form>- Put the above in a react page, type something in the number field (i.e. "1") and press submit.
- See the error occur.
- Focus the number field
- Blur the number field
- See the error dissapear
Version
1.13.0
What browsers are you seeing the problem on?
Microsoft Edge
If other, please specify.
also on FireFox and Chrome
What operating system are you using?
Windows 11
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response