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

Should mimic behaviour of window.scrollTo(0, 0);

Open stevenmunro opened this issue 4 years ago • 1 comments

window.scrollTo(0, 0); sends the page to the top. With react-scrollbars-custom enabled on the body element, this does not happen.

Could there be a prop we could pass to make it listen to window.scrollTo calls?

stevenmunro avatar Jun 22 '20 04:06 stevenmunro

I'd say that this functionality should be implemented on your side, since it will involve window function wrapping. Event listening will not work because window.scrollTo will try to scroll body element which does not have any scroll therefore it should not emit scroll event.

For past 3 years you're the first person who asked for such functionality. BTW why not to use RSC's context API to control parent scrollbars.

xobotyi avatar Jun 22 '20 10:06 xobotyi