KingSora / OverlayScrollbars

A javascript scrollbar plugin that hides the native scrollbars, provides custom styleable overlay scrollbars, and preserves the native functionality and feel.
https://kingsora.github.io/OverlayScrollbars
MIT License
3.71k stars 215 forks source link

What is wrong with such a simple example using overlayscrollbars-ngx? #600

Closed mlc-mlapis closed 6 months ago

mlc-mlapis commented 6 months ago

Describe the bug:

I tried a very simple example using the latest "overlayscrollbars-ngx" library. After checking all possible places and combinations, it's still unclear why the native scrollbar is showing while it shouldn't. It would be nice of you if you could help with this problem. Thanks a lot in advance.

To reproduce:

Please look at the example: https://stackblitz.com/edit/mlc-simple-overlayscrollbars

Environment:

KingSora commented 6 months ago

Good day @mlc-mlapis :)

I believe you just mixed up where the .container classname should be.. If you move it from the inner div to the overlay-scrollbars element everything is working. (https://stackblitz.com/edit/mlc-simple-overlayscrollbars-si7wuf?file=src%2Fmain.ts)

The problem was that if the .container classnames is applied to the inner div (which hasn't OverlayScrollbars applied) it will never overflow because of the overflow: auto style. Instead the element itself will hides the overflow and shows an scrollbar because its content is overflowing.

mlc-mlapis commented 6 months ago

@KingSora Have a lovely last day of this year!

You are right. I don't have any explanation for why I missed it. 😄 Thank you a lot.

KingSora commented 6 months ago

Thanks! Have a lovely day as well! :)