Skip to content

Commit

Permalink
fix:Hide Scrollbar before Scroll (#8896)
Browse files Browse the repository at this point in the history
Fix for the issue #8847 Hide Scrollbar before Scroll.


https://github.com/user-attachments/assets/27dda89f-e3f6-4c72-bcc5-8c7e10d3c823

---------

Co-authored-by: Félix Malfait <[email protected]>
Co-authored-by: ehconitin <[email protected]>
  • Loading branch information
3 people authored Dec 11, 2024
1 parent 4d9facb commit 07de458
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import { overlayScrollbarsState } from '@/ui/utilities/scroll/states/overlayScro

import 'overlayscrollbars/overlayscrollbars.css';

const StyledScrollWrapper = styled.div`
const StyledScrollWrapper = styled.div<{ scrollHide?: boolean }>`
display: flex;
height: 100%;
width: 100%;
.os-scrollbar-handle {
background-color: ${({ theme }) => theme.border.color.medium};
background-color: ${({ theme, scrollHide }) =>
scrollHide ? 'transparent' : theme.border.color.medium};
}
`;

Expand Down Expand Up @@ -61,10 +62,7 @@ export const ScrollWrapper = ({

const [initialize, instance] = useOverlayScrollbars({
options: {
scrollbars: {
autoHide: scrollHide ? 'scroll' : 'never',
visibility: scrollHide ? 'hidden' : 'visible',
},
scrollbars: { autoHide: 'scroll' },
overflow: {
x: enableXScroll ? undefined : 'hidden',
y: enableYScroll ? undefined : 'hidden',
Expand Down Expand Up @@ -92,7 +90,11 @@ export const ScrollWrapper = ({
id: contextProviderName,
}}
>
<StyledScrollWrapper ref={scrollableRef} className={className}>
<StyledScrollWrapper
ref={scrollableRef}
className={className}
scrollHide={scrollHide}
>
<StyledInnerContainer>{children}</StyledInnerContainer>
</StyledScrollWrapper>
</Context.Provider>
Expand Down

0 comments on commit 07de458

Please sign in to comment.