Ability to scroll to the input with error
See original GitHub issueIt would be nice to have some scrollToError method which would scroll to the highest input found which name matches one of the errors keys.
Currently, there is a similar behavior that happens after the form validation but there are cases when errors are set manually for some fields using setError API, for example, after server’s error response.
I believe I could implement such functionality outside RHF but I’d have to store input refs and names separately for this and it just feels like it would be much better if it was implemented in RHF.
Or perhaps, alternatively, if I could access all input refs mapped to fields names from RHF it would make it simpler to implement such scrolling functionality manually.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:48 (23 by maintainers)
Top Results From Across the Web
How to scroll to the first invalid control once a form has been ...
The solution to the problem was to scroll a document, once an invalid form has been submitted, so that the first invalid control...
Read more >Scroll to the first input error of HTML5 form validation
I have multiple input fields in the form marked with required attribute. So when one of the first few input fields are left...
Read more >Scroll to Input on Formik Failed Submission
The first step is to transform a Formik error object to dot-notation, so that we can later on search for inputs by their...
Read more >Snagit Scrolling Capture Not Working for Previous Versions
Uncheck the Use fastest scrolling method option. If that does not work, increase the scroll delay. Click Apply. In Snagit, click the Save...
Read more >scroll-margin - CSS: Cascading Style Sheets - MDN Web Docs
You can see the effect of scroll-margin by scrolling to a point partway between two of the "pages" of the example's content. The...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here’s one that scrolls to the top-most input:
One thing I have noticed is
errorsare not in order they are registered but alphabetical. So the first ref that you scroll to may not be the top-most. I’m not sure how one would go about doing that.