angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.32k stars 6.72k forks source link

bug(Slider): Tick marks don't align with the position of the thumb #29409

Open jonancastelo opened 2 months ago

jonancastelo commented 2 months ago

Is this a regression?

The previous version in which this bug was not present was

No response

Description

There are some values of "min", "max" and "step" together with "showTickMars" that make tick marks to dm't be aligned with the position of the thumb.

In the shared stackblitz example can be seen that:

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-t6k1kc Steps to reproduce:

  1. Visually appreciate that last tick doesn't coincide with end of slider.
  2. Move the thumb to appreciate that as you approach to the end th distance between thumb and tick marks is bigger.

Expected Behavior

Actual Behavior

Environment

jonancastelo commented 2 months ago

I have discovered where the misunderstanding is.

In slider.ts can be seen in the method updateTickMarkTrackUI comments, that the maximum reachable value is different from the maximum value set by the user.

In MatSlider documentation however, it says that max is the maximum value that the slider can have.

The last assumption may hold true behind the scenes, but for the user, the maximum value that the slider can reach is the set max value. Consequently, this explanation could lead to misunderstanding for the user.

I propose 2 possible solutions:

I could develop myself and make a pull request if you agree.

GiftLanga commented 1 month ago

Hey @jonancastelo are you going to work on this issue, or can I?

jonancastelo commented 1 month ago

Hi @GiftLanga, as there is no interest by the angular team I will not develop. Perhaps you can, good luck