[Input]: V2 Input Component's valueState Display Incorrect Popover When ValueState Set to Empty or Undefined
Bug Description
When the valueState property of the Input component is set to an empty string or undefined, an incorrect valueState message popover appears.
However, When the valueState porperty is set to "None", the incorrect popover won't display.
Affected Component
Input
Expected Behaviour
If valueState is set to undefined or an empty string, it should default to "None" to prevent the incorrect popover from appearing.
Isolated Example
https://stackblitz.com/edit/github-pzlhay-jzepmf?file=src%2FApp.tsx,package.json
Steps to Reproduce
- Use the Input component.
- Set the valueState property to "" (empty string) or undefined.
- Observe the valueState message popover that appears.
- Set the valueState property to "None", and note that the popover does not appear.
Log Output, Stack Trace or Screenshots
Priority
Very High
UI5 Web Components Version
2.3.0
Browser
Chrome, Edge, Firefox, Safari
Operating System
No response
Additional Context
No response
Organization
SF
Declaration
- [X] I’m not disclosing any internal or sensitive information.
Hello @sap/ui5-webcomponents-topic-rl ,
An empty popover opens if the set value-state is not part of the ValueState enum. Can be observed here .
This includes empty string and undefined values. To my understanding, in this case the input should behave as if the value-state is set to None.
Also evaluate the priority of the ticket. If the app developer ensures that always a valid value is being set, this problem won't occur.
Best regards, Petar
This is how enums in UI5 components are designed to work - they do not work with undefined or values outside of the Enum (unless undefined is specified in the docs).
For the input, the docs clearly state what the accepted values for valueState are:
empty string and undefined are not part of the supported values. Note that if you use the component without providing a valueState, there is a default which is "None". This is not the same as removing the valueState. If you don't want unspecified behaviour, you should set the value state to "None".
This is also modelled in typescript, if I get a reference to an input, I cannot assign "" or undefined and get the corresponding error.
In the end, the only accepted values are the ones in the docs. If you don't want a popover to appear, just set the valueState to "None" instead ot "" or undefined