[StepInput]: [Value precision for 2 decimal values is showing Invalid Entry Error]
Describe the bug
We have set valuePrecision to 2 for StepInput component, The component expects input values to have two decimal places (e.g., 40.00 or 50.00). If a user enters a whole number like 5, it automatically adds the decimals (e.g., 5.00), but then still shows an error message saying "Invalid Entry!"—which is incorrect. If user focus on the input and focus out then error message is gone. Similarly, if a user enters a number with one decimal (e.g., 5.0), the component throws an error because it expects exactly two decimals in this case (user entered value 5.0) component is not converting the one decimal point to two decimal points like the example when user enters only 5 in the setp input.
Given that the component itself is adding the decimals, it shouldn't trigger an error state when a user enters a whole number (e.g., 5, 6, 8). When user enter 5 or 5.0 it convert both the values automatically to 5.00 with error and the behavior should be consistent in case of single decimal values and it should not throw incorrect error message displaying "Invalid Entry" as the vlaue in the inout field already have 2 decimal points.
Isolated Example
No response
Reproduction steps
- Go to https://ui5.github.io/webcomponents-react/v2/?path=/docs/inputs-stepinput--docs.
- Change vaulePrecison property to 2.
- Enter 5 in input component and click outside and observe the red border for the step input element click or focus the input and it displays an error saying "Invalid entry" but we have 5.00 value in the input field.
- Now get the focus out now error is gone.
- Secondly, enter 5.0 now it converted to 5.00 but error is still there. This works fine when user enter the exact number with 2 decimal points and no error is displayed. ...
Expected Behaviour
Given that the component itself is adding the decimals, it shouldn't trigger an error state when a user enters a whole number (e.g., 5, 6, 8). When user enter 5 or 5.0 it convert both the values automatically to 5.00 with error and the behavior should be consistent in case of single decimal values and it should not throw incorrect error message displaying "Invalid Entry" as the vlaue in the inout field already have 2 decimal points.
Screenshots or Videos
UI5 Web Components for React Version
V2
UI5 Web Components Version
2.16.1
Browser
Chrome
Operating System
MAC
Additional Context
No response
Relevant log output
Organization
No response
Declaration
- [x] I’m not disclosing any internal or sensitive information.
Thanks for reporting! I'll forward this issue to our UI5 Web Components Colleagues as the affected component is developed in their repository.
Hello @UI5/ui5-team-ctr-bal,
The inconsistent behaviour of the ui5-step-input validation is explained in detail by @Harshithaharsh.
For comparison the sap.m.StepInput control doesn't set an error state, but only corrects the value according to the displayValuePrecision that has been set: https://ui5.sap.com/#/entity/sap.m.StepInput/sample/sap.m.sample.StepInput
Best regards, Boyan
This issue has been closed. To reopen, just leave a comment!
:tada: This issue has been resolved in version v2.18.0-rc.0 :tada:
The release is available on v2.18.0-rc.0
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version v2.18.0 :tada:
The release is available on v2.18.0
Your semantic-release bot :package::rocket: