-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Number input decimal cursor jump #278
Comments
Have you saw this guide? Maybe this is the fix: https://modularforms.dev/solid/guides/controlled-fields#number-input-example |
I have yeah, it doesn't seem to be the solution unfortunately |
Do you have an idea how to fix this? |
This is my best effort so far, it's not a solution (and causes it's own issues), but it points to the re-render being caused when the browser changes the value from a float to an integer |
it's interesting in that after it's been through it's initial cycle (adding the 0), it then seems to work with out jumping or adding the zero, I just can't work out why |
Thanks for your research. Since Modular Forms only provides the data layer, you should be able to customize the integration with the HTML input element to avoid this problem. |
Issue Description
When using a number input field, if a user enters a decimal number and then deletes the decimal part, the cursor unexpectedly jumps to the beginning of the input.
Steps to Reproduce
Expected Behavior
The cursor should remain at its current position after deleting the decimal part.
Actual Behavior
The cursor jumps to the beginning of the input after deleting the decimal part.
Possible Cause
This issue may be caused by the number type being converted (from float to integer) when the decimal is removed, triggering a re-render of the input field. This re-render might be resetting the cursor position.
Can be observed: https://modularforms.dev/solid/playground/special
The text was updated successfully, but these errors were encountered: