Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit c3bac33

Browse files
authored
Merge pull request #6880 from matrix-org/rav/fix_autoscroll
2 parents a811df4 + c992168 commit c3bac33

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/structures/ScrollPanel.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,15 @@ export default class ScrollPanel extends React.Component<IProps> {
277277
// fractional values (both too big and too small)
278278
// for scrollTop happen on certain browsers/platforms
279279
// when scrolled all the way down. E.g. Chrome 72 on debian.
280-
// so check difference <= 1;
281-
return Math.abs(sn.scrollHeight - (sn.scrollTop + sn.clientHeight)) <= 1;
280+
//
281+
// We therefore leave a bit of wiggle-room and assume we're at the
282+
// bottom if the unscrolled area is less than one pixel high.
283+
//
284+
// non-standard DPI settings also seem to have effect here and can
285+
// actually lead to scrollTop+clientHeight being *larger* than
286+
// scrollHeight. (observed in element-desktop on Ubuntu 20.04)
287+
//
288+
return sn.scrollHeight - (sn.scrollTop + sn.clientHeight) <= 1;
282289
};
283290

284291
// returns the vertical height in the given direction that can be removed from

0 commit comments

Comments
 (0)