From 6468ce68a2374b2d69fb240f871bdb6d07159696 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 6 Sep 2021 18:59:47 +0100 Subject: [PATCH] Fix scroll being stuck at bottom The check for whether we're at the bottom or not allowed for a difference of 1 to account for fractional scroll values, but allowed the difference of exactly 1 too, meaning we'd consider the timeline to be at the bottom if you were scrolled up by exactly a single pixel. If your scrolling was set up to be precise enough and the event handlers fired fast enough that they'd evaluate each time you scrolled up by a single pixel, it would reset you back to the bottom each time and you'd never be able to scroll up. Fixes https://github.com/vector-im/element-web/issues/18903 --- src/components/structures/ScrollPanel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/structures/ScrollPanel.tsx b/src/components/structures/ScrollPanel.tsx index 112f8d2c21..abc71bfcb2 100644 --- a/src/components/structures/ScrollPanel.tsx +++ b/src/components/structures/ScrollPanel.tsx @@ -275,8 +275,8 @@ export default class ScrollPanel extends React.Component { // fractional values (both too big and too small) // for scrollTop happen on certain browsers/platforms // when scrolled all the way down. E.g. Chrome 72 on debian. - // so check difference <= 1; - return Math.abs(sn.scrollHeight - (sn.scrollTop + sn.clientHeight)) <= 1; + // so check difference < 1; + return Math.abs(sn.scrollHeight - (sn.scrollTop + sn.clientHeight)) < 1; }; // returns the vertical height in the given direction that can be removed from