s-yadav / react-number-format

React component to format numbers in an input or as a text.
MIT License
3.9k stars 410 forks source link

Problem fixedDecimalScale #797

Open yury-github opened 1 year ago

yury-github commented 1 year ago

Describe the issue and the actual behavior

Android version < 12, fixedDecimalScale === true

If the cursor is after decimalSeparator and Backspace is pressed, the value will be saved as a whole with values after decimalSeparator.

number-format

Please check the browsers where the issue is seen

yury-github commented 1 year ago

in _onKeyDown get the event value and conditions do not work (key === 'Backspace') e.key === undefined e.code === '' e.keyCode === 229

if (key === 'Backspace' && value[selectionStart - 1] === decimalSeparator) { setCaretPosition(el, selectionStart - 1); e.preventDefault(); } photщ