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.
This commit is contained in:
Justin Halsall
2026-04-01 12:00:00 +08:00
committed by GitHub
parent c6ec00b52f
commit fcb5c036fc

View File

@@ -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