Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to edit a value sets the caret to the end of the input #48

Open
kristremblay opened this issue Aug 24, 2020 · 6 comments
Open

Trying to edit a value sets the caret to the end of the input #48

kristremblay opened this issue Aug 24, 2020 · 6 comments
Labels

Comments

@kristremblay
Copy link

It seems the vue package has an issue that the vanilla js package does not: whenever a field's value is updated, the caret is automatically moved to the end of the input.

This makes it cumbersome to make changes like changing $52,000 to $52,500.

@kristremblay
Copy link
Author

This is unfortunately a deal breaker, unless there is something I have missed in the documentation.

@AlexandreBonneau
Copy link
Member

Indeed, that behavior can be reproduced with the dollar settings (see the demo), but not with other settings like default, 'euro', 'integer', etc.

After a few tests, I could find that it's related to the currency symbol. When using:

<div class="labelClasses">With the <code>'testing'</code> option</div>
		<vue-autonumeric :options="['euro', {
							  digitGroupSeparator: '.',
							  decimalCharacter: ',',
							  decimalCharacterAlternative: '.',
							  currencySymbol: '$',
							  currencySymbolPlacement: 'p',
							  }]" v-model="autoNumericModel"></vue-autonumeric>

The bug occurs, but if you use currencySymbol: '€' then it does not.

@kristremblay
Copy link
Author

@AlexandreBonneau thank you for your quick response.

Unfortunately the issue is still intermittent even in the scenarios you describe as working correctly. It seems to work often on integer, but if I do something like ['integer', {currencySymbol: '$'}] it breaks again.

@AlexandreBonneau
Copy link
Member

Well, as it seems, it's related to the use of currencySymbol: '$'.

@AlexandreBonneau
Copy link
Member

This is related to autoNumeric/autoNumeric#684.

@kristremblay
Copy link
Author

Thanks for the link, I didn't notice that one when I searched the issues.

Up until now I've been using v-money which seems to handle this by calculating the caret position https://github.com/vuejs-tips/v-money/blob/master/src/directive.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants