From 167c1286c27d5f477e411c52b097c1e9b2dad344 Mon Sep 17 00:00:00 2001 From: Dijana Pavlovic Date: Fri, 22 Mar 2024 11:15:52 +0100 Subject: [PATCH] Fix thumb size when ignoring some top scroll --- shared/common/ui/customScrollbar/index.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/shared/common/ui/customScrollbar/index.tsx b/shared/common/ui/customScrollbar/index.tsx index ff7c34fa..c0173004 100644 --- a/shared/common/ui/customScrollbar/index.tsx +++ b/shared/common/ui/customScrollbar/index.tsx @@ -107,9 +107,12 @@ export function CustomScrollbars({ const hasV = el.scrollHeight > el.clientHeight; const hasH = el.scrollWidth > el.clientWidth; - if (scrollBarHeight === 0 && el.clientHeight < el.scrollHeight) { + if (hasV) { setScrollBarHeight( - el.clientHeight - (hasH ? 8 : verScrollBarBottomOffset) - headerPadding + el.clientHeight - + (hasH ? 8 : verScrollBarBottomOffset) - + headerPadding + + scrollBarTopOffset ); } @@ -117,8 +120,10 @@ export function CustomScrollbars({ hasV ? Math.max( 28, - ((el.clientHeight + verScrollIgnoreLength) * scrollBarHeight) / - el.scrollHeight + el.clientHeight < el.scrollHeight - verScrollIgnoreLength + ? ((el.clientHeight + verScrollIgnoreLength) * scrollBarHeight) / + el.scrollHeight + : scrollBarHeight ) : -1, hasH