m.StepInput: "valueState" doesn't stay on focus out
URL (minimal example if possible)
https://jsbin.com/hiwihaw/edit?js,output
Steps to reproduce the problem:
- Open the JSBin sample. The initial value of the StepInput is
0with thevalueState"Warning". - Click somewhere else to trigger
focusout.
What is the expected result?
The value state stays as "Warning" after focus out.
What happens instead?
On focus out, the value state gets completely overwritten since the value is within the min and max range.
Any other information? (attach screenshot if possible)
https://github.com/SAP/openui5/blob/2a44a832973e480e341128e47a3dd57f5ce5debb/src/sap.m/src/sap/m/StepInput.js#L717-L743
It would be nice if the current valueState is respected and favored over min/max. Other Input controls keep their valueState after focusout (sample). The StepInput should be aligned with them.
Hello @boghyon , Thank you for sharing this finding. I've created an internal incident 1970012594. The status of the issue will be updated here in GitHub. Regards, Filip.
Hello @boghyon ,
The issue is now fixed. When the user focuses the StepInput and then without changing its value focuses out of it, the valueState remains the same.
However, when the user changes the input value from '2' to '-2' in a StepInput with min property set to '0', the StepInput overrides the 'Warning' valueState (based on the example above) and sets it to 'Error'. Then, if the user changes the value the other way around - from '-2' to '2', the StepInput sets is valueState to 'None'.
Does this interaction of the StepInput control work for you?
Regards, Tereza
Hi @terezamch,
The issue is now fixed. When the user focuses the
StepInputand then, without changing its value, focuses out of it, thevalueStateremains the same.
Thanks! I can reproduce this behavior. Also the valueState stays after increasing and decreasing the value back with the side buttons. 👍
when the user changes the input
valuefrom '2' to '-2' in aStepInputwithminproperty set to '0', theStepInputoverrides the 'Warning'valueState(based on the example above) and sets it to 'Error'.
This, however, I can't fully reproduce. When doing so, it overwrites the 'Warning' valueState to 'None' instead of 'Error'. 🤔
Other than that, I guess we can say that the main issue is fixed by now.
This, however, I can't fully reproduce. When doing so, it overwrites the 'Warning'
valueStateto 'None' instead of 'Error'. 🤔
Well, based on the above example, it sets to 'None' obviously due to the expression binding in valueState. This is a bit tricky. But in this case, I'd actually expect that the control overwrites the valueState to 'Error' no matter what the app developer has defined in that property if the value exceeds the limit.
The actual proper solution for the app developer would be to change the expression binding to
valueState="{= ${/steps} === 0 ? 'Warning' : undefined}"
instead of ... 'Warning' : 'None'}". With undefined, it applies the default behavior of the control if the min/max is exceeded --> 'Error'.
So yea, this issue can be closed.
The issue is now fixed [...]
by https://github.com/SAP/openui5/commit/ca85d4f33ef282eb494f2e9949c8f505dd91f8f4.