Open
Description
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
scrollToIndex doesn't account for content before scrollable (when used with scrollWindow
).
Probably it should use measureViewportOffset
or similar method to account for it.
Reproduction
Steps to reproduce:
- Open https://stackblitz.com/edit/angular-ewgqzt?file=src/app/cdk-virtual-scroll-window-scrolling-example.ts
- Click on button
Scroll to index #1
Expected Behavior
Viewport should be scrolled so Scroll to index #1
, so is the first element.
Actual Behavior
Viewport is scrolled but "Content before" is the first element. It's off by "content before" height.
Environment
- Angular: 15
- CDK/Material: 15.1.2
- Browser(s): Chrome 108
- Operating System (e.g. Windows, macOS, Ubuntu): macOS