A plain input located before a controller steals focus on error
See original GitHub issueDescribe the bug A plain input located before a controller steals focus on error.
To Reproduce
I have a form with 3 inputs: first and last ones use a Controller
, and the one in the middle is a regular input using register
. All fields are empty and required.
- When I click on submit
- Then the focus is on the middle field whereas it should be on the first one.
Codesandbox link https://codesandbox.io/s/react-hook-form-input-after-controller-focus-issue-lfd9m
Expected behavior The focus should be on the first field having an error.
Screenshots
Desktop
- OS: Ubuntu 20.04.1 LTS
- Browser: Chrome
- Version: 85.0.4183.83
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
React.js - input losing focus when rerendering - Stack Overflow
The only reason that'd happen is if a) something else steals focus, or b) the input is flickering. Could you provided a jsfiddle/jsbin...
Read more >Forms in HTML documents - W3C
An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), and...
Read more >Handle errors in ASP.NET Core | Microsoft Learn
By Tom Dykstra. This article covers common approaches to handling errors in ASP.NET Core web apps. See Handle errors in ASP.
Read more >Buggy Code: 10 Common Rails Programming Mistakes - Toptal
Common Rails Programming Mistake #1: Overloading the Controller With Logic. Rails is based on an MVC architecture. ... Enter Plain Old Ruby Objects...
Read more >5. Separation of Concerns - Programming JavaScript ... - O'Reilly
Separation of concerns is the idea that each module or layer in an application should only be responsible for one thing and should...
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
I can’t prevent myself to be disappointed, since it will give me quite a lot of extrawork.
But thanks for your help! I appreciate your fast answers and this excellent library ☺
I guessed I had to do that 😅
However it’s an unexpected and undocumented behavior, is it?