Skip to content

Controlled form resets focus on every keystroke #4544

@joesaunderson

Description

@joesaunderson

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

When using the form in controlled mode, every keystroke into the form resets the forms focus.

Example:

const App = () => {
  const [formData, setFormData] = React.useState(null);
  return (
    <Form
      schema={{ type: 'string' }}
      formData={formData}
      onChange={(e) => setFormData(e.formData)}
      validator={validator}
    />
  );
};

Expected Behavior

It should maintain the focus state of the element.

Steps To Reproduce

Run the above code, type into the form.

Environment

React 18

Anything else?

Linked to #391 (changing to controlled form as a workaround due to the attached issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions