angular / angular/components

bug(mat-slider): Incorrect slider thumb position when changing min/ max and form value

Open
#32,521 4 comments 0 reactions 0 assignees View on GitHub
area: material/slider P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

A range slider is bound to a reactive form using `formControlName`; min/ max properties are also bound.
After programmatically updating min/ max variables and calling `setValue` to update the form values, observed behaviour is that range slider thumbs don't match the form values. Expected behaviour is that thumb positions match the calls to `setValue`.

https://github.com/user-attachments/assets/3bb7de78-5d05-436d-90ac-f1288fac8a32

### Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-starter-xwmbwzkn?file=src%2Fmain.ts
Steps to reproduce:
1. Select Category A (this sets ranges to be [10, 20] + [20, 30], and absolute min/ max to be [10, 30])
2. Select Category B (this sets ranges to be [5, 15] + [15, 25], and absolute min/ max to be [5, 25])
3. Hover over 1st slider's thumbs

### Expected Behavior

Expected slider 1's thumbs to be at [5, 15] (to match form values after having called `setValue`)

### Actual Behavior

Observed slider 1's thumbs to be at [10, 15] (which doesn't match form values)

### Environment

- Angular: 20.3.15
- CDK/Material: 20.2.14
- Browser(s): Chrome Version 143.0.7499.41 (Official Build) (64-bit)
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11

Contributor guide

Open the contributing guide

Research direction

Start with the StackBlitz reproduction in src/main.ts and reproduce the category changes with the reactive form, bound min/max values, and mat-slider. Inspect how the slider updates its thumbs after min/max and setValue change. Done means slider 1 shows thumbs at [5, 15], matching the form values after selecting Category B.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.