react-scrollbars-custom icon indicating copy to clipboard operation
react-scrollbars-custom copied to clipboard

Broken scroll with permanentTrackY

Open egor-pogodin opened this issue 6 years ago • 5 comments

Hi! Thanx for you plugin it's realy good one! But i found some strange behavior. I've made a wrapper component for Scrollbar to pass all nesessary stuff

const Scroller = ({children, inverted}) => (
        <Scrollbar
            permanentTrackY
            children={children}
            renderer={({elementRef, ...props}) => (
                <div {...props} ref={elementRef} className={CN}/>
            )}
            wrapperProps={{
                renderer: ({elementRef, ...props}) => (
                    <div {...props} ref={elementRef} className={cn(CLASSES.WRAP, {inverted})}/>
                )
            }} />
)

and use it in my layout component

const LayoutRightSidebar = ({title, action, children, sidebar}) => (
    <div className={CN}>
        <section className={`${CN}__container`}>
            <div className={`${CN}__body`}>
                <Scroller>
                    <ContentBlock title={title} action={action}>
                        {children}
                    </ContentBlock>
                </Scroller>
            </div>
            <aside className={`${CN}__side`}>
                <Scroller>
                    {sidebar}
                </Scroller>
            </aside>
        </section>
    </div>
);

When i'm loading a page with this layout scrollbars act randomely. It could be working a sidebar but content not, sometimes nothing is working at all. On each refresh you've got random result.

PS if permanentTrackY is disabled - everything is perfect

egor-pogodin avatar Sep 20 '19 21:09 egor-pogodin

Hm. I'll take a look when return from vacation.

xobotyi avatar Sep 26 '19 07:09 xobotyi

Also running into issues when enabling permanentTrackY to true. Although my problem might be totally unrelated to OP's problem as I am having problems with react-measure and toggling "display: none" on a parent element. Basically the element comes back with overflow: hidden; set which prevents the mousewheel scrolling. Really hard to give an example but hopefully OP has a working example which would also fix my issue.

jrmyio avatar Oct 04 '19 14:10 jrmyio

I have a feed component with the permanentTrackY. And if there's no messages initially, after I add a batch of them, the scroll doesn't work. I need to click on the scrollbar once, to awake it. Without permanentTrackY it works fine. If the component initially rendered with scroll it also works fine.

DZakh avatar Nov 03 '20 13:11 DZakh

@DZakh that is a great hint, thank you. ill try to investigate some time later.

xobotyi avatar Nov 08 '20 19:11 xobotyi

I am having a similar issue with permanentTrackY set to true. For me the scrollbar is only responding when dragged manually with the mouse after permanentTrackY=false. With permanentTrackY=true it is responding to scrollwheel event like expected...

SeanPedersen avatar Dec 12 '20 21:12 SeanPedersen