[Feature Request]: Offer value-state-change
event & allow preventing internal value-state changes
#7444
Projects
value-state-change
event & allow preventing internal value-state changes
#7444
Feature Request Description
In UI5 Web Components for React we're increasingly receiving issues about value-state handling.
In React it's common to fully control a component, meaning that you are always aware of its state which is controlled by a React state. E.g.:
2023-08-15_11-35-51.mp4
codeSandbox
Here the
value
of theInput
is controlled by a React state, every time the value is updated by the useronInput
is called and there the React state is updated with the respective value of the input.For the
value-state
this behavior can sometimes not be achieved. As example I'm reusing parts of the codeSandbox provided in this issue.2023-08-15_11-47-28.mp4
codeSandbox
Here the
StepInput
should keep the "Success" value-state, but since there is no way to prevent the internal validation (setting the value-state internally) and there is no public event developers could register to, it gets kind of tricky without using an observer to detect these changes and then also to adjust the React state accordingly.With the help of a public custom event (e.g.
value-state-change
), developers could handle value-state changes in the same way as e.g.value
changes. Additionally, it would be great if the event would allow preventing the default behavior (internal value-state changes) by callingevent.preventDefault()
Proposed Solution
value-state
changesevent.preventDefault()
in the handler of the new event.Proposed Alternatives
If it's not feasible to implement we will outline this particularity in our documentation.
Organization
UI5 Web Components for React
Additional Context
Example of Issues that would most probably profit or even be fixed by this feature:
change
event doesn't work with React state #4791Priority
None
Privacy Policy
The text was updated successfully, but these errors were encountered: