primefaces / primefaces/primereact

InputNumber swallows first keystroke when locale uses non-ASCII numerals (e.g. bn)

Open
#8,521 0 comments 0 reactions 1 assignee View on GitHub

@8lurry is already working on this.

Since Apr 1, 2026.

Type: Bug
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Describe the bug

When InputNumber is used with a locale that formats digits as non-ASCII characters
(e.g. bn / Bengali, which formats 1 as ), typing the digit 1 as the very
first character of an empty field produces onValueChange with value: null instead
of value: 1. All subsequent keystrokes work normally. The same bug affects every
digit on first keystroke for any locale whose numeral system does not include ASCII
digits.

Root cause

getPrefixExpression() and getSuffixExpression() extract the prefix/suffix by
calling formatter.format(1) and splitting on the ASCII string '1':

prefixChar.current = formatter.format(1).split('1')[0];
suffixChar.current = formatter.format(1).split('1').pop();

For Bengali locale, format(1) returns '১' (U+09E7). That string contains no
ASCII '1', so .split('1')[0] returns the entire value '১' as the prefix.
parseValue() then strips this "prefix" from the typed string, leaving an empty
string that evaluates to null.

Affected locales

Any locale where new Intl.NumberFormat(locale).format(1) does not contain ASCII
'1' — including but not limited to: bn, ar, ar-EG, ne, mr, as, my.

Environment

  • PrimeReact version: 10.x (confirmed with current main)
  • Browsers: all (pure JS logic)
Reproducer

No response

System Information
System:
    OS: Linux 6.8 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 3.99 GB / 15.33 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 24.12.0 - /usr/local/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 11.12.1 - /usr/local/bin/npm
    pnpm: 10.21.0 - /usr/local/bin/pnpm
  Browsers:
    Chromium: 146.0.7680.164
    Firefox: 148.0.2
    Firefox Developer Edition: 148.0.2
  npmPackages:
    primereact: ^10.9.7 => 10.9.7 
    react: ^18.3.1 => 18.3.1
Steps to reproduce the behavior
<InputNumber locale="bn" allowEmpty onValueChange={(e) => console.log(e.value)} />
  1. Render the component above.
  2. Focus the empty input.
  3. Press the key 1.
  4. Observe: onValueChange fires with value: null.
Expected behavior

onValueChange should fire with value: 1 on the first keystroke.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.