From fcb5c036fc689725012f144002f86ab5991b3a28 Mon Sep 17 00:00:00 2001 From: Justin Halsall Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] Fix: scrolling on elements being is ignored (#1029) In certain cases when scrollLeft is being set, but the value doesn't change. Then scrollTop is also ignored, even if that value was changed. In this case we use the `scrollTo` api as it doesn't have that issue. --- packages/rrweb/src/replay/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/rrweb/src/replay/index.ts b/packages/rrweb/src/replay/index.ts index 61696fbc..201bd339 100644 --- a/packages/rrweb/src/replay/index.ts +++ b/packages/rrweb/src/replay/index.ts @@ -1757,8 +1757,11 @@ export class Replayer { }); } else { try { - (target as Element).scrollTop = d.y; - (target as Element).scrollLeft = d.x; + (target as Element).scrollTo({ + top: d.y, + left: d.x, + behavior: isSync ? 'auto' : 'smooth', + }); } catch (error) { /** * Seldomly we may found scroll target was removed before