primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.59k stars 1.23k forks source link

InputNumber: The backspace key doesn't work (strange behavior) #3951

Open nicolascvoodoo opened 1 year ago

nicolascvoodoo commented 1 year ago

Describe the bug

You can reproduce the issue on the current documentation InputNumber >> Currency >> Germany.

Here is a quick showcase of the issue (each time the cursor goes left, the backspace key was hit):

https://github.com/primefaces/primevue/assets/75260382/e4dc3cea-c665-4881-8833-47a245c9bd13

The issue can be reproduced when you select the value with the mouse (without the currency symbol) and update the value. You can no longer remove digits. The symbol should be on the right of the value. When the symbol is on the left, everything work fine.

Reproducer

https://codesandbox.io/s/r23s2n?file=/src/App.vue

PrimeVue version

3.29.0

Vue version

3.x

Language

ALL

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

Note that the issue happen only when the symbol is on the right of the value:

  1. Select the value with the mouse (without the currency symbol)
  2. update the value
  3. You can no longer remove digits.

Expected behavior

The backspace key should remove the digit.

micdobro commented 12 months ago

Experiencing exactly the same using Danish locale.

Ver.: 3.40.1

<InputNumber
  mode="currency"
  currency="DKK"
  locale="da-DK"
  v-model="entity.trade_value"
  :min="1.0"
  :allowEmpty="false"
/>

When I use backspace to delete contents of the field it results in a string: 1,00 k. k. k. k. k. kr. - where the number of repetitions of k. = backspace presses.

Delete does not work, either.

It only allows entering 3 digits and no fraction. When I change to:

<InputNumber
    v-if="true"
    v-model="entity.trade_value"
    :min="1.0"
    :minFractionDigits="2"
    :maxFractionDigits="2"
    :allowEmpty="false"
/>

then I get my "pseudo-currency" working, although I must admit the currency input mode is great.

In the documentation all currency fields seem to be working without any issues.

Let me know if I can help in any way.

PS It looks like locale parser/generator goes out of its mind.

micdobro commented 12 months ago

Replicated on 3.41.0.