Skip to content

Commit 9184787

Browse files
authored
fix(cdk/scrolling): reset more properties to avoid jumping during virtual scroll (#33439)
Sets `overflow-anchor` and `scroll-behavior` on the virtual scrollable to avoid jumping in some cases. Related to #32715.
1 parent f7da3f2 commit 9184787

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/cdk/scrolling/virtual-scroll-viewport.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ cdk-virtual-scroll-viewport {
4747
overflow: auto;
4848
will-change: scroll-position;
4949
contain: strict;
50+
51+
// Prevent browser behaviors from interfering with virtual scrolling.
52+
overflow-anchor: none;
53+
scroll-behavior: auto;
5054
}
5155

5256
// Wrapper element for the rendered content. This element will be transformed to push the rendered
@@ -59,7 +63,6 @@ cdk-virtual-scroll-viewport {
5963

6064
// Note: We can't put `will-change: transform;` here because it causes Safari to not update the
6165
// viewport's `scrollHeight` when the spacer's transform changes.
62-
6366
[dir='rtl'] & {
6467
right: 0;
6568
left: auto;
@@ -86,7 +89,6 @@ cdk-virtual-scroll-viewport {
8689

8790
// Note: We can't put `will-change: transform;` here because it causes Safari to not update the
8891
// viewport's `scrollHeight` when the spacer's transform changes.
89-
9092
[dir='rtl'] & {
9193
transform-origin: 100% 0;
9294
}

0 commit comments

Comments
 (0)