kendo-react icon indicating copy to clipboard operation
kendo-react copied to clipboard

NumericTextBox typing nonnumeric chars triggers change when the value is selected.

Open simonssspirit opened this issue 3 years ago • 4 comments

NumericTextBox typing non-numeric chars trigger change when the value is selected.

Retro steps using this example https://stackblitz.com/edit/react-eriqm7-r6ek4g?file=app/main.tsx

  1. Focus NumericTextBox

  2. Type valid char (eg. number 1)

  3. Select typed value

  4. Press non-numeric character (eg. key 'd').

Result: Selected value is deleted and Change event was triggered with e.value == null

simonssspirit avatar Sep 09 '21 07:09 simonssspirit

Current behavior is expected as you are trying to replace the value with new one which cannot be parsed. It's incorrect to set any number like zero in that case, which is the reason why null value is set.

vladimirivanoviliev avatar Feb 11 '22 08:02 vladimirivanoviliev

I am reopening the issue, because the same behavior is observed when you have selected the value and you press "-". It still clears the value, but pressing "-" again will set "-0" as the current value, which should be the result after the first time.

kdikov82 avatar May 26 '22 08:05 kdikov82

Related with #1042

kdikov82 avatar Jun 20 '22 12:06 kdikov82

~~A possible temporary workaround for the case where the input is focused after tabbing and the entire value is selected is to handle the onFocus event of the NumericTextBox and set the cursor position at 0: https://stackblitz.com/edit/react-bu4tse?file=app%2Fmain.tsx~~

Actually the workaround should be to set -0 directly when the value is cleared by hitting the "-": https://stackblitz.com/edit/react-bu4tse-eak9ft?file=app%2Fmain.tsx

kdikov82 avatar Jun 20 '22 14:06 kdikov82

The fix is available in the latest official version: https://github.com/telerik/kendo-react-private/releases/tag/v5.18.0

nstoychev avatar Sep 15 '23 08:09 nstoychev