sakhnyuk / rc-scrollbars

React scrollbars component
https://rc-scrollbars.vercel.app/
MIT License
145 stars 14 forks source link

Unable show Scrollbar On Google Chrome(and Safari) which does not display scroll bars by default #34

Open ellis-s opened 2 years ago

ellis-s commented 2 years ago

Hi, I used this react component a few days ago, It's very efficient!

But, today I find a compatibility problem. It does't work when Google Chrome is set to not show the scroll bar by default.

The cause of the problem is the getScrollbarWidth.ts file. You will get number 0 by function getScrollbarWidth when Google Chrome is set to not show the scroll bar by default. Because the value of div.offsetWidth equal to the value of div.clientWidth.

elvinasv commented 2 years ago

Hi, @ellis-s, I have a similar issue.

Google Chrome is set to not show the scroll bar by default

Are you using Chrome feature flag to enable/disable scrollbar by default?
I had to set Show scroll bars to Always on macOS Monterey (v12.5) (as suggested by https://stackoverflow.com/a/22865691). Then the scrollbar started to appear where expected on all browsers.