From 6593c0d61dfedb8b32c7fded0b66cb932e97ebac Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Wed, 24 Jun 2026 09:56:54 +0200 Subject: [PATCH] fix(cdk/scrolling): reset more properties to avoid jumping during virtual scroll Sets `overflow-anchor` and `scroll-behavior` on the virtual scrollable to avoid jumping in some cases. Related to #32715. --- src/cdk/scrolling/virtual-scroll-viewport.scss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cdk/scrolling/virtual-scroll-viewport.scss b/src/cdk/scrolling/virtual-scroll-viewport.scss index 47a102b6a2ed..599b76fcb830 100644 --- a/src/cdk/scrolling/virtual-scroll-viewport.scss +++ b/src/cdk/scrolling/virtual-scroll-viewport.scss @@ -47,6 +47,10 @@ cdk-virtual-scroll-viewport { overflow: auto; will-change: scroll-position; contain: strict; + + // Prevent browser behaviors from interfering with virtual scrolling. + overflow-anchor: none; + scroll-behavior: auto; } // Wrapper element for the rendered content. This element will be transformed to push the rendered @@ -59,7 +63,6 @@ cdk-virtual-scroll-viewport { // Note: We can't put `will-change: transform;` here because it causes Safari to not update the // viewport's `scrollHeight` when the spacer's transform changes. - [dir='rtl'] & { right: 0; left: auto; @@ -86,7 +89,6 @@ cdk-virtual-scroll-viewport { // Note: We can't put `will-change: transform;` here because it causes Safari to not update the // viewport's `scrollHeight` when the spacer's transform changes. - [dir='rtl'] & { transform-origin: 100% 0; }