Skip to content

CdkVirtualScrollViewport content offset resets on scroll  #15538

@mak2xt

Description

@mak2xt

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Manually set offset by setRenderedContentOffset should not go back to 0 on scroll

What is the current behavior?

Scrolling resets offset which is perceived as a jump

What are the steps to reproduce?

https://stackblitz.com/edit/angular-egcu9t
just click on "set offset to 200", see applied offset and then try to scroll

What is the use-case or motivation for changing an existing behavior?

I'm using this feature to create date picker similar to one in kendo(https://www.telerik.com/kendo-angular-ui/components/dateinputs/calendar/)

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

material 7.3.x

Is there anything else we should know?

Here's the responsible code:
https://github.com/angular/material2/blob/master/src/cdk/scrolling/fixed-size-virtual-scroll.ts#L81
https://github.com/angular/material2/blob/master/src/cdk/scrolling/fixed-size-virtual-scroll.ts#L149

As I got from the debugger, newRange.start is always 0, and it's seen from line 81 the function executes on scroll

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/scrolling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions