Repository navigation
v0.185.2
Patch Changes
-
#1438
d5e6f749Thanks @tenphi! - Fix a native reset of a<Form action>, for bothForm.useForm()andForm.useController()forms. The form now resets once and reports the defaults toonValuesChange, as a form withoutactionalready did. Before, React Aria wrote each input's starting value on its own, soformElement.reset()could leave aCheckboxGroupempty. In aForm.useController()action form,Form.Resetnever reset the controller, and the rootonResetran only after those writes, too late to cancel them.actionstill hands submission to the browser. With or withoutaction, a named control the form does not own, such as a bare<input name="token">, is reset the way the browser would reset it; before, the form's reset left it unchanged. -
#1436
dc2c7d72Thanks @tenphi! - FixPasswordInput,TextArea,CommandTextArea,Checkbox,CheckboxGroup,RadioGroup,ColorSwatchGroup,SwitchandSelectrenderingform="[object Object]"on their native inputs when bound to aForm.useForm()instance, whether through a surrounding<Form>or theformprop. React Aria writesformonto the input as the id of the<form>it belongs to, so the attribute named no form and detached the input from its own: pressing Enter in aPasswordInputsubmitted nothing. The form instance no longer reaches the DOM, so these inputs now behave inside a legacy form as they already did withForm.useController(): Enter in aPasswordInputsubmits the form, and Enter on aCheckbox,Switchor radio submits it when the form has a submit button. A native reset of a legacy form, such asForm.ResetButtonorformElement.reset(), now resets the form once and reports the defaults toonValuesChange, asForm.useController()forms already did; before, React Aria wrote each input's starting value on its own (aCheckboxGroupcould end up empty). On the text fields, aformid passed throughinputPropsstill applies.ColorSwatchGroupalso no longer throws when a native form reset clears a group that mounted with no value. -
#1436
dc2c7d72Thanks @tenphi! -useFieldProps's return type no longer promises what the hook strips. It no longer listsfield,dependsOnordeps, and it drops aForm.useController()controller fromform's type:formdeclared asFormController<…>comes backundefined, while aForm.useForm()instance comes back as before. A custom control that read the controller off the result compiled and then threw on its first write. It now fails to compile: take the controller from the control's own props, or write through the boundonChange. The check needsformdeclared in an interface that extendsFieldBaseProps(orOmit<FieldBaseProps, 'form'>);FieldBasePropstypesformasany, and an intersection with it staysany.