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.78k stars 214 forks source link

Unable to scroll if container isn't scrollable on mount #578

Closed hlynurstef closed 10 months ago

hlynurstef commented 10 months ago

Describe the bug The content is sometimes not scrollable depending on the container height on mount or if the container height changes through resizing the browser window

To Reproduce Reproduction demo:

https://codesandbox.io/p/sandbox/overlayscrollbars-react-example-forked-skjq7t?file=%2Fsrc%2FApp.tsx%3A10%2C39 https://skjq7t-5173.csb.app/

https://github.com/KingSora/OverlayScrollbars/assets/15615089/f94eb75c-82c8-4d01-afbb-a44517eebbfd

  1. Open the reproduction demo
  2. Resize the window smaller so that it overflows the container
  3. Reload the page
  4. See that it can be scrolled
  5. Resize your window so that the red box stops overflowing
  6. Resize the window back so that the red box overflows
  7. Notice the scroll doesn't work anymore
  8. See attached video for demonstration

Also try:

  1. Resizing the window so that the red box doesn't overflow
  2. Reload the page
  3. No scroll (expected)
  4. Resize the window so that the red box overflows
  5. No scroll (not expected)

Expected behavior The scroll should appear if the window is resized causing overflow

Environment

KingSora commented 10 months ago

@hlynurstef Thanks for the report! Thats a regression since v2.4.0.. I'll release a fix as quick as possible

KingSora commented 10 months ago

@hlynurstef This should be fixed in the newest version v2.4.3.

https://codesandbox.io/p/sandbox/overlayscrollbars-react-example-forked-w3vp49

hlynurstef commented 10 months ago

@KingSora thanks for the quick fix!

KingSora commented 10 months ago

@hlynurstef you're welcome! :)