sakhnyuk / rc-scrollbars

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

When zooming out, the default scroolbar is shown in FF #40

Open papins opened 1 year ago

papins commented 1 year ago

I read previous discussion about the same error https://github.com/sakhnyuk/rc-scrollbars/issues/15 Provided fix (https://github.com/sakhnyuk/rc-scrollbars/pull/17) works fine for Chrome (Win10), but does not for Firefox (dev edition 117.0b9 (64-bit) + Win10)

Example: https://2n8jhh.csb.app/ (source https://codesandbox.io/s/rc-scrollbars-test-forked-2n8jhh) image

The problem is with function getPxRatio() src/utils/getScrollbarWidth.ts In FF window.screen.availWidth === document.documentElement.clientWidth for all zoom levels when page body doesn't have vertical scrollbar. Function always returns 1 and that does not trigger the scrollbarWidth updating.

window.screen.availWidth !== document.documentElement.clientWidth when page has vertical scrollbar. In this case scrollbarWidth is updating correctly.