angular / angular/components

bug(cdk-virtual-scroll-viewport): If there is not enough data without caching, the scrolling operation will be invalid.

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

Beschreibung

### Is this a regression?

_No response_

### Description

If there is not enough data without caching, the scrolling operation will be invalid.

### Reproduction

StackBlitz link:https://stackblitz.com/edit/angular-sbfsdw?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fng-zorro-antd.module.ts,src%2Fapp%2Fapp.module.ts
Steps to reproduce:
1. If you scroll the mouse in the container, the scroll bar will always react, resulting in unsuccessful scrolling.
2. If you drag the scroll bar directly, you can basically scroll normally, and if the data length is in a certain interval, there will be obvious problems of unsuccessful scrolling.

The core code is as follows:
```
@Component({
selector: 'nz-demo-button-basic',
template: `




`,
styles: [
`
.example-viewport {
height: 600px;
width: 200px;
border: 1px solid black;
}

.example-item {
height: 250px;
border: 1px solid red;
}
`,
],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NzDemoButtonBasicComponent {
// length 20000 scroll working
// length 20 scroll no working
items = Array.from({ length: 20 }).map((_, i) => `Item #${i}`);
}
```

### Expected Behavior

No matter the size of itemsize or the amount of data, the scrolling effect is normal.

### Actual Behavior

Unable to scroll up and down

### Environment

- Angular: 16+、18+
- CDK/Material: 16+、18+
- Browser(s):
- Operating System (e.g. Windows, macOS, Ubuntu):

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Run the linked StackBlitz reproduction from src/app/app.component.ts with templateCacheSize set to 0 and a short items array. Start at the cdk-virtual-scroll-viewport behavior for insufficient data, then verify scrolling with different item counts and itemSize values. Done means mouse-wheel and scrollbar dragging both scroll normally regardless of data length.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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