Skip to content

Commit

Permalink
Fix CustomScrollbars off-by-one error
Browse files Browse the repository at this point in the history
  • Loading branch information
raksooo committed Jan 22, 2024
1 parent d0366a1 commit 9d19ce1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gui/src/renderer/components/CustomScrollbars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,9 @@ class CustomScrollbars extends React.Component<IProps, IState> {
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 });

Expand Down

0 comments on commit 9d19ce1

Please sign in to comment.