question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A plain input located before a controller steals focus on error

See original GitHub issue

Describe 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.

  1. When I click on submit
  2. 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 image

Desktop

  • OS: Ubuntu 20.04.1 LTS
  • Browser: Chrome
  • Version: 85.0.4183.83

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vcarelcommented, Aug 26, 2020

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 ☺

1reaction
vcarelcommented, Aug 26, 2020

I guessed I had to do that 😅

However it’s an unexpected and undocumented behavior, is it?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found