angular / angular/components

bug(cdk/listbox): using scrollbar with mouse breaks

Aperta
#30,900 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area: cdk/listbox P3
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

When using the cdk listbox on a list that scrolls, the listbox and scroll position behaves weird if that scrollbar is operated with a mouse. The behavior gets worsed if a value is selected.
Operated by mouse means either:
- clicking on the little arrows in that scrollbar
![Image](https://github.com/user-attachments/assets/122a6579-3a13-41a4-b595-ead2c72a33e0)
- clicking on a blank space within that scrollbar
![Image](https://github.com/user-attachments/assets/fa5229c2-6466-43ce-a5db-9ada9555d432)

I think there was recently a similar issue in the menu: https://github.com/angular/components/pull/30249

### Reproduction

StackBlitz link: Also broken in your docs at https://material.angular.io/cdk/listbox/examples
Steps to reproduce:
1. Got to example `Listbox with forms validation.`
2. Select option `Rat`
3. Click the down arrow two times in the scrollbar / or two times at a blank location

### Expected Behavior

It should just scroll normally.

### Actual Behavior

First click scrolls, at second click it jumps back to the top.

### Environment

- Angular: 19 / and the version your docs use
- CDK/Material: 19 / and the version your docs use
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Linux / Mac

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con l'esempio di listbox CDK `Listbox with forms validation` nella documentazione di Angular Material e riproduci il problema selezionando `Rat`, quindi facendo clic due volte sulla barra di scorrimento. Confronta il comportamento con la modifica correlata al menu in PR 30249. Il lavoro è completato quando i clic sulla barra di scorrimento continuano a eseguire uno scorrimento normale senza saltare all'inizio, anche dopo la selezione di un valore.

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à
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.