Skip to content

Input type="Number": value disappears on typing "dot" #1675

@ilhan007

Description

@ilhan007

Issue
The input value disappears in Input type="Number"
when the user types decimal number separators: the user can type a single "dot" in the input field, but if the user type a second one, the value disappears. (Also it turns out this is locale specific, for other locales this happens on typing "comma").

Root cause: this happens because the native input fires an event with empty value and we sync our value to empty. This can be observed with pure HTML input, however the user input remains:

 <input id='myInput' type="number">

 myInput.addEventListener("input", (e) => {
    // if we have already typed "1." and type a second ".",
    // the "input" event is fired and the "e.target.value" would be a empty string
     console.lof(e.target.value); 
});

To reproduce
Steps to reproduce the behavior:

  1. Go to https://sap.github.io/ui5-webcomponents/master/playground/main/pages/Input/
  2. Find input type="Number" example at the bottom
  3. Type "1", after that start typing "." (dots) and you will see that on the second dot, the value disappears

Expected behavior
The user input should remain as with the native input element

Context

  • UI5 Web Components version 1.0.0-rc.7
  • OS/Platform: {...} macOS
  • Browser (if relevant): {...} Chrome

Affected components ui5-input

Metadata

Metadata

Assignees

Labels

Low PriobugThis issue is a bug in the code

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions