Skip to content

Cursor resets to wrong position after select all and type new character #575

Closed
@Exolent

Description

@Exolent

When using a mask like a phone number "(000) 000-0000", there are some cursor positioning issues. If you enter some input and then select all (with the keyboard shortcut or using the mouse), and then try to type new data to replace the old data, the cursor will sometimes not be in the correct position.

For example, go to the demo page seen here:
https://igorescobar.github.io/jQuery-Mask-Plugin/

  1. Enter in the US Telephone field the number "1" which should change the value to "(1"
  2. Select all
  3. Attempt to type "(123) 123-1231"
  4. After typing the first 1, the cursor is positioned between the "(" and "1".
  5. After typing all of the numbers, it looks like this: "(231) 231-2311" because the cursor was put before the first "1", it is now at the end of the phone number.

The issue used to work when selecting a whole phone number and attempting to type a new one, but that seems to be fixed with v1.14.11. However, the issue I described still remains.

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