question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Input type="Number": typing decimal separator causes value to disappear

See original GitHub issue

Hi,

There’s an issue in the Input control when its type is Number. When trying to type a decimal number, only a comma (,) can be used as the decimal separator. When trying to use a dot (.), the input’s text is emptied. This can be confusing to the user, as he/she doesn’t know that only the comma separator is accepted. Here is a small sample where you can test the behaviour of the control.

To fix this problem, I think the dot separator should be accepted. Then, when the user focus out of the control (or anything else that could trigger the change event), the input’s value could be formatted to use a comma separator instead of a dot separator. Or the dot separator could also be left in the input’s value…

Furthermore, after typing a decimal number (for example, 3,14), if the user presses the up (or the down) arrow, the value is incremented (or decremented) to the next integer (for example, 3). I think that it should increment (or decrement) the value by 1. So, for example, if the user types 3,14 and then press the down arrow, the value should become 2,14 instead of 3. Or, even better, a property could be added to specify how much the value should be incremented (or decremented).

Do you think all of this would make sense?

Thanks! Mathieu

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ilhan007commented, May 17, 2020

Hello @mathlizee

Yes I think so, after a quick research in the net, it seems like locale specific.

0reactions
ilhan007commented, May 22, 2020

From the 3 issues, 1 left about the empty value and it will be tracked in a new issue: https://github.com/SAP/ui5-webcomponents/issues/1675

Read more comments on GitHub >

github_iconTop Results From Across the Web

Input type="Number": value disappears on typing "dot" #1675
Issue The input value disappears in Input type="Number" when the user types decimal number separators: the user can type a single "dot" in ......
Read more >
Typed decimal disappears from HTML text input of type ...
I see what your'e saying now, when I type the decimal, the output disappears. Fortunately, it reappears when you enter any number on...
Read more >
Browser support for <input type="number"> with different ...
The value of an <input type="number"> must always be either a valid integer (number) or a valid decimal number. The specification defines ...
Read more >
Decimal value is rounded up/down to integer value - Office
When you enter a decimal value in a column in Microsoft Access, the decimal value is rounded up or down to an integer...
Read more >
textfield to accept decimal and numbers only in react - You.com
The HTML5 input type=number is inadequate from the localization point of view, due to both the definition and the implementations.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found