Skip to content

v0.185.2

Choose a tag to compare

@tenphi tenphi released this 28 Sep 14:18
· 160 commits to main since this release
88a09ce

Patch Changes

  • #1438 d5e6f749 Thanks @tenphi! - Fix a native reset of a <Form action>, for both Form.useForm() and Form.useController() forms. The form now resets once and reports the defaults to onValuesChange, as a form without action already did. Before, React Aria wrote each input's starting value on its own, so formElement.reset() could leave a CheckboxGroup empty. In a Form.useController() action form, Form.Reset never reset the controller, and the root onReset ran only after those writes, too late to cancel them. action still hands submission to the browser. With or without action, 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 dc2c7d72 Thanks @tenphi! - Fix PasswordInput, TextArea, CommandTextArea, Checkbox, CheckboxGroup, RadioGroup, ColorSwatchGroup, Switch and Select rendering form="[object Object]" on their native inputs when bound to a Form.useForm() instance, whether through a surrounding <Form> or the form prop. React Aria writes form onto 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 a PasswordInput submitted nothing. The form instance no longer reaches the DOM, so these inputs now behave inside a legacy form as they already did with Form.useController(): Enter in a PasswordInput submits the form, and Enter on a Checkbox, Switch or radio submits it when the form has a submit button. A native reset of a legacy form, such as Form.ResetButton or formElement.reset(), now resets the form once and reports the defaults to onValuesChange, as Form.useController() forms already did; before, React Aria wrote each input's starting value on its own (a CheckboxGroup could end up empty). On the text fields, a form id passed through inputProps still applies. ColorSwatchGroup also no longer throws when a native form reset clears a group that mounted with no value.

  • #1436 dc2c7d72 Thanks @tenphi! - useFieldProps's return type no longer promises what the hook strips. It no longer lists field, dependsOn or deps, and it drops a Form.useController() controller from form's type: form declared as FormController<…> comes back undefined, while a Form.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 bound onChange. The check needs form declared in an interface that extends FieldBaseProps (or Omit<FieldBaseProps, 'form'>); FieldBaseProps types form as any, and an intersection with it stays any.