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

y-scrollbar handle goes past track length #542

Closed szmarczak closed 1 year ago

szmarczak commented 1 year ago

Describe the bug

image

To Reproduce

Use the example below and scroll all the way down.

Expected behavior

Should be inside the gray bar.

Examples

https://stackblitz.com/edit/vitejs-vite-gamrvo?file=src%2FApp.svelte

Environment

KingSora commented 1 year ago

Good day @szmarczak

Nice catch - after some time of checking my math I've concluded that this is happening because I'm using rounded values provides by the browser with its offsetHeight and offsetWidth values. Switchting them with their corresponding getBoundingClientRect() counterparts gets rid of this problem.

This fix will be in the next release which should be published soon. I'll inform you once its out.

KingSora commented 1 year ago

@szmarczak I've published overlayscrollbars v2.2.1 which should fix this issue! Here is the full changelog: https://github.com/KingSora/OverlayScrollbars/blob/master/packages/overlayscrollbars/CHANGELOG.md#221

In case the new release didn't fix your issue please don't hesitate to re-open or to create a new one.