Skip to content

Caret moved to the end of input after change #63

@agka

Description

@agka

Steps to reproduce

  • set up a card number input with auto formatting
  • begin to type in a card number, with enough digits to trigger formatting (eg 4242 42)
  • move caret position somewhere before the last digit, can be anywhere (eg 424|2 42)
  • delete a digit (for instance the second 4 of the example: 42|2 42)

Caret is then moved to the end of input (eg. 4224 2|).

(Edit) The same goes when adding a digit in the middle of the current value

  • set up a card number input with auto formatting
  • begin to type in a card number, with enough digits to trigger formatting (eg 4242 42)
  • move caret position somewhere before the last digit, can be anywhere (eg 424|2 42)
  • add a digit (eg. 4248|2 42)

Caret is then moved to the end of input (eg. 4248 242|).

Reproduced on https://jondavidjohn.github.io/payform/

This bug occurs as long as there are enough digits to trigger the formatting. If there is fewer chars (id est, only three digits), the caret position is not changed

Expected behavior

Caret position should not change

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