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

It is not possible to disable scrolling in any web browser

Open andrew-aladev opened this issue 4 years ago • 1 comments

Hello, I know that project is abandoned, just want to notice everyone still using it.

React custom scrollbars are using internal layout with wrapper + content inside. wrapper has overflow: hidden, content has overflow: scroll. content is not intended to be scrolled inside wrapper, but it actually works.

I've received browser native auto scrolling using textarea inside content. So wrapper.scrollTop become 15 and ugly empty native scroll appeared.

It is not possible to disable scrolling for wrapper completely in any browser, native scrollbars have enough power to scroll everywhere. So it is important to add wrapper.scrollTop = 0 after scrollbar update method.

andrew-aladev avatar May 25 '20 13:05 andrew-aladev

diff --git a/node_modules/react-custom-scrollbars/lib/Scrollbars/index.js b/node_modules/react-custom-scrollbars/lib/Scrollbars/index.js
index 4780fee..ac2227e 100644
--- a/node_modules/react-custom-scrollbars/lib/Scrollbars/index.js
+++ b/node_modules/react-custom-scrollbars/lib/Scrollbars/index.js
@@ -653,6 +653,9 @@ var Scrollbars = function (_Component) {
                 (0, _domCss2["default"])(this.thumbHorizontal, thumbHorizontalStyle);
                 (0, _domCss2["default"])(this.thumbVertical, thumbVerticalStyle);
             }
+
+            this.container.scrollTop = 0;
+
             if (onUpdate) onUpdate(values);
             if (typeof callback !== 'function') return;
             callback(values);

andrew-aladev avatar May 25 '20 13:05 andrew-aladev