Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When you use validation on a component with multiple child inputs pressing enter on the previous input will throw an error #39

Open
sam-parallax opened this issue Nov 8, 2021 · 0 comments

Comments

@sam-parallax
Copy link

  • Set up two components, one standard input and one custom component with multiple inputs as children

Screenshot 2021-11-08 at 10 41 50

  • Press enter while in the first component, it will try to find the next input field from the ref but as the ref is actually a custom component and not an input the 'current' value is null. This will throw an error. Merlin.js (line 141)

Screenshot 2021-11-08 at 10 37 44

const nextFocusableInput = nextInputs.find( (element) => inputRefs[element.props.name]?.current?.focus )

This would ignore the next input and just submit the form, not ideal but would stop the error from happening. The other solution would be to look for input children in a custom component with a ref.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant