ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

[Input]: V2 Input Component's valueState Display Incorrect Popover When ValueState Set to Empty or Undefined

Open mrmabo opened this issue 2 years ago • 2 comments

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

  1. Use the Input component.
  2. Set the valueState property to "" (empty string) or undefined.
  3. Observe the valueState message popover that appears.
  4. Set the valueState property to "None", and note that the popover does not appear.

Log Output, Stack Trace or Screenshots

Screenshot 2024-10-30 at 1 57 10 PM

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.

mrmabo avatar Oct 30 '24 18:10 mrmabo

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

dimovpetar avatar Oct 31 '24 08:10 dimovpetar

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: Screenshot 2024-10-31 at 10 59 04

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. Screenshot 2024-10-31 at 11 01 36

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

pskelin avatar Oct 31 '24 09:10 pskelin