Inputmask
Inputmask copied to clipboard
Caret position always on end of input value
- 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)
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);