Skip to content

deleting negative sign with backspace also deletes the last digit #597

@dimitri-HR

Description

@dimitri-HR

Describe the issue and the actual behavior

When trying to delete the minus sign '-' with a backspace, the last digit is also removed
Affects inputs with prefixes.

Describe the expected behavior

Only the negative sign should be removed

Provide a CodeSandbox link illustrating the issue

happens even on the official demo site
https://jinno.io/app/23/isAllowed?source=react-number-format&displayType=input

Provide steps to reproduce this issue

have an input field with the prefix (e.g $)
type a negative number, e.g. -123
you will see something like this: -$123
move cursor left to the front, e.g. before '123'
press backspace on the keyboard to delete the negative sign

The result: negative sign is removed but also the last digit is removed (e.g. $12) and the cursor is moved to the end

Please check the browsers where the issue is seen

  • Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions