Inputmask icon indicating copy to clipboard operation
Inputmask copied to clipboard

Caret position always on end of input value

Open nbrkusanin opened this issue 4 years ago • 2 comments

  • Describe the bug

These are my settings for currency inputMask:

  let prefix = currency
  if (currency === 'USD') {
    prefix = '$'
  } else if (currency === 'CAD') {
    prefix = 'CA$'
  } else if (currency === 'AUD') {
    prefix = 'A$'
  } else if (currency === 'GBP') {
    prefix = '£'
  } else if (currency === 'EUR') {
    prefix = '€'
  }
  return {
    prefix: `${prefix} `,
    groupSeparator: ',',
    alias: 'decimal',
    placeholder: '0',
    autoGroup: true,
    digits: 2,
    digitsOptional: false,
    clearMaskOnLostFocus: false,
    unmaskAsNumber: true,
    autoUnmask: true,
    allowMinus,
    max: Math.pow(2, 32) / 2 - 1
  }
}

When I want to enter a number somewhere in between, it always sets my cursor to the end of the input value. It allows me to insert one character and then sets cursor to the end.
This is not case when autoUnmask is set to false and when I'm not using v-model.

Does anyone have a solution?

Thanks.
- OS:
Any OS

- Browser
Chrome

- Inputmask version
3.3.11 (tried with 5.0.6)

nbrkusanin avatar Aug 23 '21 09:08 nbrkusanin

In my case the caret jumps to the first digit when i select the last for a default v-model value of '0.00'

Inputmask({
        min: '0.00',
        max: '9999999999.99',
        radixPoint: '.',
        alias: 'decimal',
        placeholder: '0.00',
        digits: 2,
        clearMaskOnLostFocus: false,
      }).mask(el.value);

lebadapetru avatar Dec 05 '21 21:12 lebadapetru