From 9d19ce18751b4ce9185e678c6a2d94e19d42b8c6 Mon Sep 17 00:00:00 2001 From: Oskar Nyberg Date: Mon, 22 Jan 2024 16:41:55 +0100 Subject: [PATCH] Fix CustomScrollbars off-by-one error --- gui/src/renderer/components/CustomScrollbars.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gui/src/renderer/components/CustomScrollbars.tsx b/gui/src/renderer/components/CustomScrollbars.tsx index 65db8c87fe54..45e7ad521dca 100644 --- a/gui/src/renderer/components/CustomScrollbars.tsx +++ b/gui/src/renderer/components/CustomScrollbars.tsx @@ -542,8 +542,9 @@ class CustomScrollbars extends React.Component { const thumbHeight = this.computeThumbHeight(scrollable); thumb.style.setProperty('height', thumbHeight + 'px'); - // hide thumb when there is nothing to scroll - const canScroll = thumbHeight < scrollable.offsetHeight; + // hide thumb when there is nothing to scroll. We've had issues with scrollHeight being + // off-by-one, to ensure this doesn't happen we subtract 1 here. + const canScroll = thumbHeight < scrollable.offsetHeight - 1; if (this.state.canScroll !== canScroll) { this.setState({ canScroll });