Skip to content

Commit e92e64b

Browse files
Juice10Vadman97
authored andcommitted
Fix: scrolling on elements being is ignored
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.
1 parent 3112169 commit e92e64b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/rrweb/src/replay/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,8 +1909,11 @@ export class Replayer {
19091909
});
19101910
} else {
19111911
try {
1912-
(target as Element).scrollTop = d.y;
1913-
(target as Element).scrollLeft = d.x;
1912+
(target as Element).scrollTo({
1913+
top: d.y,
1914+
left: d.x,
1915+
behavior: isSync ? 'auto' : 'smooth',
1916+
});
19141917
} catch (error) {
19151918
/**
19161919
* Seldomly we may found scroll target was removed before

0 commit comments

Comments
 (0)