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

Unexpected scrolling when scrolling container is focused #629

Closed luin closed 5 months ago

luin commented 5 months ago

Describe the bug

If I have a element that is:

  1. Out of the viewport
  2. Focused

The page would scroll unexpectedly if I make the element an instance of OverlayScrollbars.

To Reproduce

  1. Go to https://overlayscrollers-abortive-pocket.surge.sh/ (Inspect the source code for how it's implemented)
  2. Wait for 2 seconds

Expected behavior

The page should not be scrolled. The editor is focused with preventScroll: true. It's unexpected that creating a OverlayScrollbars would scroll the page.

Environment

Additional context

I believe to fix the issue, we should pass preventScroll: true in focusElm because we only want to focus instead of scrolling.

KingSora commented 5 months ago

Good day @luin :)

Nice catch! I've published v2.7.3 which uses { preventScroll: true } when focusing the viewport.

luin commented 5 months ago

@KingSora Thanks a lot! That's the fastest response and fix I've ever experienced on GitHub in the past 10 years 😄

KingSora commented 5 months ago

@luin Since I'm often slowed down by these processes as well, I'm trying to lead by example in my own repositories.. Its not always possible but whenever it is I'm trying

Glad I could help :)