score:1

Accepted answer

looks like you need to add onfocus to please react-hook-form when it wants to focus the input. see the onfocus prop of controller here. note that this prop was removed in rhf v7.

<controller
  render={({ ref, ...rest }) => (...)}
  name={name}
  onfocus={() => {
    const inputel = document.queryselector(
      `input[name="${name}"]`
    );
    inputel.focus();
  }}

codesandbox demo


Related Query

More Query from same tag