Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Slider] Incorrect behavior with small increment/decrement values #4385

Open
georgi-sla opened this issue Aug 16, 2024 · 0 comments
Open

[Slider] Incorrect behavior with small increment/decrement values #4385

georgi-sla opened this issue Aug 16, 2024 · 0 comments

Comments

@georgi-sla
Copy link
Contributor

georgi-sla commented Aug 16, 2024

Describe the bug
Currently, when the developer sets the smallStep property of the Slider component to 0.01, the component stops working at a value of 0.29(if this value is skipped, the component then stops working at 0.57, 0.58, 1.13, etc.) - this means that the user can use the drag handle to change the value in the Slider, but the increment button cannot change this value.

To Reproduce

  1. Create a Slider component.
  2. Set the min, max, and value properties.
  3. Set the smallStep property to 0.01.
  4. Use the buttons to change the value in the Slider.

Please, check out the following StackBlitz demo: https://stackblitz.com/edit/angular-8n8e4e

Expected behavior
The buttons for changing the value should work regardless of the value set to the component.

Additional context
The valueChange event is also not fired when the increment button stops working.

The problem seems to be related to the logic in the sliders-util.ts file, and more precisely the remainder function. The function divides 0.29 by 0.01 which gets us 28.999999999999996, which is then floored to 28 instead of rounded to 29.

Can be similar to #4360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants