Skip to content

Slider cannot always be dragged to the max setting #10148

@gchurchley

Description

@gchurchley

Bug

If the max value is not divisible by the step size, then sometimes the slider cannot be dragged to the maximum setting

What is the expected behavior?

Should be able to drag the slider all the way from min to max settings. (This is always possible with the keyboard arrow keys.)

What is the current behavior?

Sometimes unable to drag to the max if the final step size is less than the configured step size.

What are the steps to reproduce?

Here's the stackblitz example

In this example, the slider is configured thus:
<mat-slider [min]="5" [max]="100" [step]="15"></mat-slider>

It is not possible to drag to the max - but you can get to the max with the keyboard.
Note: If you change the min to zero, then it becomes possible to drag to the max even though the final step is still less than the step size. [?]

NOTE that with any configuration it is possible to reach the max via the keyboard. It is only the drag that stalls before reaching the max with some configurations. It seems like the problem occurs when the final step would be fairly small (like less than half a step size).

What is the use-case or motivation for changing an existing behavior?

A slider that can be moved to the max via the keyboard but not via the mouse drag is not acceptable.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular v5.2.6
Material v5.2.1
TypeScript v2.5.3

Is there anything else we should know?

no

Metadata

Metadata

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions