Skip to content

Commit

Permalink
Fix: scrolling on elements being is ignored (#1029)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Juice10 authored Nov 12, 2022
1 parent 9bbc3e0 commit fdb7135
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/rrweb/src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fdb7135

Please sign in to comment.