Skip to content
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

Replacing a previous digit when the field is not fully filled yet should highlight the next character of the replaced digit #20

Closed
michael-jong-ds opened this issue Jun 20, 2023 · 2 comments

Comments

@michael-jong-ds
Copy link

michael-jong-ds commented Jun 20, 2023

For example if we want to type in the code 123456,
but we missed the 2 (maybe because the keyboard is not working properly), so instead, we type in 13456

We would have the field like this
[1] [3] [4] [5] [6] [|]

then, we would try to correct it by clicking on the digit field with 3 in it

[1] [3|] [4] [5] [6] [] with | as cursor

since the 3 is now highlighted we want to replace it with 2.
if we type in 2, then the field state would be like this
[1] [2] [4] [5] [6] [|]

the cursor jumps from the 2nd digit field to the unfilled digit
this might be frustrating for user since user has to go back again and again to the previous field to fill everything out.
While the user might be able to fully fill out the digits first, then go back and retype the wrong digits, it would be better experience if we highlight the next character, instead of the next unfilled field.

Expectation:
[1] [3|] [4] [5] [6] []

if we type in 2 from this position
the state should be

[1] [2] [4|] [5] [6] []

and then type 3

[1] [2] [3] [5|] [6] []

so we can fill it in with 4, 5, and 6, completing the field.

@Demetri0
Copy link

Demetri0 commented Jun 20, 2023

Btw... what if the value in a box not selected, but cursor are in a box:

Selected:
Screenshot from 2023-06-20 18-13-46

Value not selected, but cursor in the box:
Screenshot from 2023-06-20 18-15-14

** You can achieve this by pressing: Arrow Up, Arrow Down, Home, End, PgUp, PgDown keys, or using mouse.

What should happen in the second variant? For now pressing 2 digit doing nothing but just move cursor to the end. (Tested on MUI OTP Field home page)
Behavior that I can expect is that right part of value should be shifted, so the result should be next:
Screenshot from 2023-06-20 18-16-53

@michael-jong-ds
Copy link
Author

Behavior that I can expect is that right part of value should be shifted, so the result should be next:

yeah that would be nice, then if the cursor is before the value
Screenshot from 2023-06-21 09-47-35
it should shift the values to the right

Screenshot from 2023-06-21 09-49-14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants