Skip to content

Invalid cursor position #65

Description

@mashafomasha

We want to allow user to type any digit, dot or comma symbols and replace comma with dot on the fly.

const numberAccept = /[\d.,]+/g;

const parseNumber = string =>
  (string.replace(",", ".").match(numberAccept) || []).join("");

But when user types comma symbol cursor visually jumps to the wrong position before new dot symbol.

Sandbox example:
https://codesandbox.io/s/istarkovrifm-numberformat-e6jfu?fontsize=14

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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