Skip to content

Number input decimal cursor jump #278

Open
@phll2

Description

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

  1. Enter a decimal number (e.g., "1.25") into the number input field.
  2. Delete the decimal part (e.g., delete ".25").
  3. Observe that the cursor jumps to the beginning of the input instead of staying at the end.

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

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions