react-otp-input icon indicating copy to clipboard operation
react-otp-input copied to clipboard

Title: Restrict focus to first empty input field

Open nasim67reja opened this issue 1 year ago • 1 comments

  • Describe the Feature Request

Hello,

I have been using the react-otp-input package and I have found an issue with the way the focus is handled. Currently, if I click on the third or fourth input field and enter a value, the value is entered in the first input field and the focus moves to the next input field which ones i have clicked for example four if i clicked one three. This behavior is not intuitive and can be confusing for users.

I would like to request a feature where the focus is restricted to the first empty input field. This means that if a user clicks on any input field, the focus should automatically move to the first empty input field. This will ensure that users can only enter values sequentially and will prevent any confusion.

Thank you for considering this feature request. I look forward to hearing your thoughts on this.

Best regards, Nasim

  • Describe Preferred Solution

nasim67reja avatar May 18 '23 07:05 nasim67reja

I second this, but I would ask for some more. I think it would make sense to allow for users to navigate to any empty field. What doesn't make sense is the bug which fills the wrong input.

It would be great if we had an option to choose between the two:

  • restrict to first empty input (as issue's author stated @nasim67reja)
  • navigate to any empty inputs, but handling the values correctly (instead of the current bug)

RemyMachado avatar Nov 22 '23 16:11 RemyMachado