angular / angular/components

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

Offen
#30,900 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: cdk/listbox P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit dem CDK-Listbox-Beispiel `Listbox with forms validation` in der Angular-Material-Dokumentation und reproduzieren Sie das Problem, indem Sie `Rat` auswählen und anschließend zweimal auf die Bildlaufleiste klicken. Vergleichen Sie das Verhalten mit der verwandten Menüänderung in PR 30249. Als abgeschlossen gilt, wenn Klicks auf die Bildlaufleiste weiterhin normales Scrollen ausführen, ohne an den Anfang zu springen, auch nachdem ein Wert ausgewählt wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.