Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollbars not appearing/disappearing when internal elements height changes #37

Open
justinasci opened this issue Mar 19, 2023 · 2 comments

Comments

@justinasci
Copy link

Scrollbars not appearing/disappearing when internal elements height changes.

Bug is reproducible on Chrome, Edge, Opera, but works as intended on Firefox.

Repro project: https://codesandbox.io/s/react-hooks-usestate-forked-utzu8n?file=/src/index.js

  1. Increase height with "+" button until content no longer fits into scroll view
  2. Notice scrollbar not appearing
  3. Try scrolling down with mouse wheel/track pad for scrollbars to appear.
  4. Decease height with "-" button until content content fits into scroll view
  5. Notice scrollbar not disappearing
@bkistyping
Copy link

Did you ever find a solution for this?

@justinasci
Copy link
Author

@bkistyping This lib doesn't, track size changes of its child container. One of the solutions is to do it ourselves.
I modified the original repro project to do just that https://codesandbox.io/p/sandbox/stupefied-bird-m77fgv

First of all we wrap scrollbars children in div and track its size changes with resize observer and couple of refs (there is a hidden scrollbars ref property if you are using TS). Later, we call scrollbars to update itself on each change.

Of course preferred solution would be fixing in the lib...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants