-
New Feature
-
Resolution: Done
-
Normal
-
8.0.4.2
-
Security Level: Jimmy
-
None
-
None
Steps to Reproduce
configure a spinner like this
<spinner id="sp" constraint="min 1"/>
The spinner value is initially empty (null value).
Click the spinner up button
Current Result
The spinner shows the value 2
Expected Result
In such cases with a lower boundary (min constraint) it feels more usable to start with the lowest possible value if the value was previously empty.
In this case after pressing up I'd expect to see the first possible value "1"
When the lower bound is 0 or negative I'd expect to see the value "1" too
For lower bounds > 0 I'd expect to see the lowest possible value.
Debug Info
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/inp/Spinner.js#L120-L131
Root Cause
checkValue() determines the starting position in case of a null value which seems to do the expected.
which is then followed by a call to de/increment the value (resulting in the unexpected value)
if de/incrementing is skipped for a previously empty value that initializes into a non-zero value the usability could be improved giving more reasonable results.
Workaround
custom JS override