final-form / final-form-focus

🏁 Final Form "decorator" that will attempt to apply focus to the first field with an error upon an attempted form submission
MIT License
83 stars 15 forks source link

Focus not working with FieldArray and server side validation #33

Open vrobert-ipsosenso opened 2 years ago

vrobert-ipsosenso commented 2 years ago

Are you submitting a bug report or a feature request?

bug

What is the current behavior?

  1. Create a form with a field array (subForm in the demo) and one field (firstName in the demo)
  2. Add validation to subForm's fields
  3. Add server side validation to firstName
  4. Trigger only the server side validation
  5. The error is displayed, but firstName isn't focused

What is the expected behavior?

firstName should be focused

Sandbox Link

https://codesandbox.io/s/react-final-form-focus-on-first-error-forked-vz1kh?file=/src/validate.js

What's your environment?

final-form 4.20.2 final-form-arrays 3.0.2 final-form-focus 1.1.2 react 16.13.1 react-dom 16.13.1 react-final-form 6.5.0 react-final-form-arrays 3.1.2