Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p-inputnumber: multiple problems when input number looses focus #15014

Closed
rosenthalj opened this issue Mar 11, 2024 · 1 comment · Fixed by #15015
Closed

p-inputnumber: multiple problems when input number looses focus #15014

rosenthalj opened this issue Mar 11, 2024 · 1 comment · Fixed by #15015
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@rosenthalj
Copy link
Contributor

Describe the bug

The following problems occur when p-inputnumber looses focus (on blur)

  1. If the p-inputNumber field is empty and looses focus, a null pointer exception occurs
  2. If the p-inputNumber field has a value and looses focus, the model value is changed from a "number' to a "string"

The following video is of the PrimeNG p-inputnumber v17.10.0 demo and shows issue 1)

inputNumberNullPointerException.mov

The following video is of the reproducer I created and shows issue 2)

inputNumberFocusChangesModelFromNumberToString.mov

I believe this bug was caused by PR #14871

Fix__14869_-LeftArrowKey_not_working_for_selected_input_by_hanneslim·Pull_Request__14871·_primefaces_primeng

Environment

windows and mac os

Reproducer

https://stackblitz.com/edit/h7br3x

Angular version

17.2.2

PrimeNG version

17.10.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

21.4.0

Browser(s)

chrome, firefox, and safari

Steps to reproduce the behavior

To reproduce issue 1)

  1. In any browser, open the console
  2. Run the PrimeNG numeral demo: http://localhost:62382/inputnumber#numeral
  3. clear any of the input files and then tab out of the field
  4. examine the console window, a null pointer exception will be displayed (bad)

To reproduce issue 2)

  1. run the reproducer: https://stackblitz.com/edit/h7br3x
  2. Set focus to the p-inputNumber field
    -- "Input value" will be the same value as the p-inputNumber field (good)
    -- "Input value type" will be "number" and have a green background color (good)
  3. Tab out of the field
    -- "Input value" will be the same value as the p-inputNumber field (good)
    -- "Input value type" will be "string" and have a red background color (bad)

Expected behavior

For issue 1), no exception should be generated
For issue 2), the input value type should not change from a number to a string

@rosenthalj rosenthalj added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 11, 2024
cetincakiroglu added a commit that referenced this issue Mar 13, 2024
fixes #15014: fixed issue with input number loosing focus
@cetincakiroglu cetincakiroglu added this to the 17.11.0 milestone Mar 13, 2024
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Mar 13, 2024
@cetincakiroglu
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants