primefaces / primefaces/primereact

Inconsistent behavior when replacing input value with decimal point in InputNumber

Open
#8,252 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs Triage
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Title:

Hello Everyone 👋

I noticed an inconsistency in the InputNumber component when handling replacement of values with the decimal point (.).

Steps to reproduce

  1. Type a number in the input (e.g. 123).
  2. Select the entire number.
  3. Press . (decimal point).
  4. The input gets cleared (empty).
  5. Press . again → now the input becomes 0.00.

Expected behavior

When selecting an existing value and pressing dot "." or "," (depends on the numbers system) , the field should immediately be replaced with 0.00 (similar to how selecting a number and typing another digit replaces the entire input).

This would make the behavior consistent with how other characters/digits work when replacing a selected value.

Current behavior

First press of "." clears the input.

Only after pressing . again does it add 0.00.

Why this matters

It is inconsistent compared to typing a number after selecting text.

Suggested improvement

When the entire input is selected and . is pressed:

Replace the content with 0.00x immediately (instead of clearing first).

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.

Research direction

Start at the InputNumber component and reproduce the selection-and-decimal-point sequence for both dot and comma decimal systems. Trace how the selected value is replaced and verify the change by confirming that the first decimal-point press produces 0.00 immediately, without an intermediate empty state.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.