-
Environment
If possible, link to a minimal repro: https://codesandbox.io/s/blueprint-sandbox-jx0ef?file=/src/NumericInputBasicExample.tsx Steps to reproduce
Actual behaviorvalue being displayed is rounded to one decimal point, e.g. 12.6 Expected behaviorExpect value to be displayed as 12.55 Possible solutionChange the implementation of So value isn't being rounded to have the same precision as minorStepSize (default: 0.1)
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Rounding also happens when min/max changes, and when components mount/unmount: |
Beta Was this translation helpful? Give feedback.
-
This feels similar to #4024, so I pose the same question... what do you expect to happen once a user clicks the increment/decrement buttons? Do you expect it to go, for example 12.55 -> 12.65 -> 12.75 etc? |
Beta Was this translation helpful? Give feedback.
-
Thanks Adi. In our use case, we don't have buttons that users click to increment/decrement values, and we don't document the use of keyboard/mouse interactions to increment/decrement either. I believe that, if a value was inputed by a user, then that value should be rendered as it was inputed.
And if the user wants to click buttons/keyboard/mouse interactions, then i think it could go, 12.55 -> 12.6 -> 12.7 etc. |
Beta Was this translation helpful? Give feedback.
-
Generally, I agree with this, and there is probably some change to the NumericInput component required here. However, given the below information, this feels like an abuse of the component:
Why use a NumericInput at all then? Why not simply |
Beta Was this translation helpful? Give feedback.
-
That's a good point. However the I still think the above point with "if a value was inputed by a user, then that value should be rendered as it was inputed", is valid. Do you see this change being made in the near future? |
Beta Was this translation helpful? Give feedback.
-
I can imagine this getting "fixed" in the medium term, but I think a better terminology / mental model for this component is a "Numeric Stepper"; you should think about the increment/decrement interaction as intrinsic to its design.
This sounds like it could be confusing for some people as well, so I'm not sure about implementing this behavior. Is there anything preventing you from modifying |
Beta Was this translation helpful? Give feedback.
I can imagine this getting "fixed" in the medium term, but I think a better terminology / mental model for this component is a "Numeric Stepper"; you should think about the increment/decrement interaction as intrinsic to its design.
This sounds like it could be confusing for some people as well, so I'm not sure about implementing this behavior.
Is there anything preventing you from modifying
minorStepSize
to get the behavior you want?