-
Notifications
You must be signed in to change notification settings - Fork 71
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
Cursor jumps to end of input #5
Comments
Correct, let me fix that. |
Okay, this seems to be more difficult than I thought. Let me back to you asap! |
I've spent many hours down this rabbit hole with |
Hey @viclafouch is there a fix or a workaround for this? |
It would be great if there was a fix for this @viclafouch 🙏 |
I had the same problem when I created a simple version of phone number input that would accepts only numbers. You can get the caret-position of the input for every input-event from the input-ref. Then you need to calculate the correct new position and set it manually. I hope this might help you with fixing this problem. Here are the get/set caret position functions for getting the start caret position and setting it into correct position after checking the new input (allowed digits/chars). My input accepts only numbers and it doesn't check any international formats get/set caret position
Simple Phonenumber-input component: In this example, I have replaced my StyledInput in the code with a regular
|
Any updates, problem still exists. |
hey @viclafouch |
Hi @viclafouch |
Hello everyone ! Looking at the solution next week, as I am in vacation rn ! Thanks for your collab ! |
Any news on this? |
Can't release because of a bug : |
I'm also facing this, I'd really appreciate it if this fix gets released soon, cheers |
@viclafouch can this issue please be reopened until it is fixed? I'm a little confused now because there doesn't seem to be an open issue tracking this bug anymore? Or has it been moved somewhere else? |
Any updates on this? |
@viclafouch any updates on this issue? |
Hi all, Ive had a similar issue in my code base. While positioning the caret manually can help i found the best solution to be using a wrapper around the component in question that allows the value state to be set synchronously and asynchronously at the same time. https://gist.github.com/mjsarfatti/6e1261f0be5f3c9eef5da1cda7bd3ffe |
I realise this happens when the input has the phone number formatting, if it doesnt, it works just fine. Can we reopen this till its fixed @viclafouch |
#170 |
@viclafouch ,
Thanks for sharing your work on
mui-tel-input
, it's the the best React / MUI implementation I've found yet.When editing a digit in the middle of the phone number string, upon becoming valid or invalid, the cursor jumps to the end. This makes it impossible to easily edit the area code or correct a typo.
How to reproduce:
+16505555555
+14155555555
The user must keep repositioning the cursor back to the edit point.
Configuration being used:
The text was updated successfully, but these errors were encountered: