carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.84k stars 1.81k forks source link

[Bug]: Input type number sets empty value when dot is used #17158

Open AlyonaSidarenka opened 2 months ago

AlyonaSidarenka commented 2 months ago

Package

@carbon/react

Browser

No response

Package version

1.63.0

React version

18.2.0

Description

When using TextInput component with type="number", and entering value that ends with ".", empty value is set. e.g. when I provide value "3." I expect it to be parsed to 3 or that onChange would not be triggered, but in reality it is triggered and value is undefined, note that using "," doesn't trigger onChange.

Reproduction/example

https://stackblitz.com/edit/github-ihxqde-cqoysd?file=src%2FApp.jsx,package.json

Steps to reproduce

visit stackblitz example link, enter "3." to the input field, see console.log

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

emyarod commented 1 week ago

this seems to be an upstream issue https://github.com/facebook/react/issues/11877