Closed cdellacqua closed 1 year ago
Guys it's about 1 1/2 years and what are you waiting for? Just sane simple enough to copy paste.
what are you waiting for?
@NoelJacob There's additional complexity around this issue, it wasn't linked here but should've been. There's been a lot of related discussion in https://github.com/carbon-design-system/carbon/issues/8690, https://github.com/carbon-design-system/carbon/issues/8689, https://github.com/carbon-design-system/carbon/issues/6930. I think the closest we've gotten to addressing this was in https://github.com/carbon-design-system/carbon/pull/7215
Beyond that, it bears repeating that our team is finite and unable to take on every request we get. As such, sometimes things don’t get the attention they might deserve or have measurable progress despite being great ideas.
Opening a pull request proposing this idea through code is a great way to breathe life into this and begin to gather feedback from the team.
I want to highlight the work of @jqlio18, who added support for floating point step values to carbon-components-svelte
. The approach is to use the native stepUp and stepDown
methods on the input element.
What package(s) are you using?
carbon-components
carbon-components-svelte
Detailed description
I was trying to use the NumberInput component and I found out that using the up and down buttons instead of the arrow keys on my keyboard (thus triggering the custom function that changes the value) causes the classic approximation problem of the floating point binary representation.
The native
<input type="number">
isn't affected by this issue because browsers take into account the inaccuracy of the binary representation and implement ways to avoid the problem.It should be noted that Firefox doesn't seem to be affected by this problem, at least visually
Steps to reproduce the issue
CodeSandbox: https://codesandbox.io/s/flamboyant-hellman-2cdnf
Additional information
A possible solution to fix the problem could be to temporary treat the operands as integers, as presented in the following code, in the function that updates the value of the input when the arrow buttons are clicked: