bug(mat-slider): Incorrect slider thumb position when changing min/ max and form value
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
### 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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con la riproduzione StackBlitz in src/main.ts e riproduci i cambiamenti di categoria con il reactive form, i valori min/max associati e mat-slider. Esamina come lo slider aggiorna i suoi thumbs dopo la modifica di min/max e setValue. Il lavoro è completato quando lo slider 1 mostra i thumbs su [5, 15], in corrispondenza dei valori del form dopo aver selezionato Category B.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100