Skip to content

NumberField isn't always clear when it converts a number #1879

Open
@snowystinger

Description

📝 Feedback

A German user pasting the value "22.2222" (an English formatted number possibly) into the input will cause the component to try to parse it as "222.222". The NumberField should be clearer that it has done this as it's a very small change and hard to necessarily see.

Some suggestions have been:
Leave it as is. This has the downside of not being transparent that we have parsed a different way potentially since we don't emit the string onChange, we only emit a number.
Mark as invalid. Maybe not the most intuitive. Do we leave the input as is in this situation and not try to parse? Or is there some way to indicate, your value will/has change(d).

There's the added consideration of a NumberField with a max of 100 in the previous example, currently the NumberField will clamp to that max if the number entered is larger, so "22.2222" pasted into a German users page would turn into "100" on blur, which is also confusing.

🔦 Context

originally reported here: https://twitter.com/PipoPeperoni/status/1390379294212378625

💻 Code Sample

🌍 Your Environment

Software Version(s)
[Package name]
Browser
Operating System

🧢 Your Company/Team

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions