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
focusInput(0) not working after render #341
Comments
@hrithik73 It seems to be working just fine. I came here looking for finding a way to find a way to programmatically focus. So I guess you can close the issue yourself. |
@harishydav I think on the first render it doesn't work as expected, The expected behavior is to focus on the first input when you click on the label but after some focusing on any input field if you click on the label it works fine as expected |
@hrithik73 have you tried |
Yeah , But i need auto focus when clicked on label |
any updates on this ? |
Sadly No :( , |
I've a workaround
|
It's a good workaround but the UX will not be good as it shows the pointer moving from 2nd position to 1st in real-time. |
What I am trying to do:-
I want to click on the label to get focus on the first input field
How I am Doing?
I am using useRef and accesing
focusInput()
function with arguement0
Expected Behavior:-
It should focus on the first input
Current Behavior:-
0th Input does not get the focus after rendering but after any changes in any input It works
1,2,3 inputs works fine i want the first one to get focused
Steps to reproduce the issue:
https://codesandbox.io/s/react-otp-input-demo-v2-forked-ng3l1s?file=/src/App.js
Relevant error messages and/or screenshots:
Is there any other way to achieve this?
Thanks in advance
The text was updated successfully, but these errors were encountered: