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

Native scrolling (scrollbar and keyboard) is blocked/prevented during lenis scroll animation #107

Open
thasmo opened this issue Jan 26, 2023 · 2 comments
Labels

Comments

@thasmo
Copy link

thasmo commented Jan 26, 2023

Describe the bug
During the lenis scroll animaton, scrolling via scrollbar or keyboard shortcut (scrollbar) is blocked/prevented (by lenis). In other words, the scroll animation, triggered/executed by lenis, can not be interrupted/cancelled by native scrolling via scrollbar or space bar.

Imo when scrolling natively (via scrollbar, spacebar, etc.) the current scroll animation should be cancelled/stopped immediately to give the user control over the scroll experience/behavior.

To Reproduce
codepen

@clementroche
Copy link
Member

clementroche commented Feb 3, 2023

Let me explain how lenis works:

  • Listen to wheel events and prevent the event to block the native scroll.
  • Get the wheel delta value to increase the target value.
  • Animate the scroll to reach the target value.
  • Scroll events (keyboard, grab scrollbar, etc.) catched during this animation time are ignored because there is no way to prevent them, Lenis is only preventing wheel events. And conversely, scroll events catched out of this animation time update scroll value.

So because there is no way to discriminate native scroll events over scroll events triggered by lenis animation, your ask seems impossible. Currently the only way the user can take control over the scrollTo animation is to scroll using MouseWheel

@thasmo
Copy link
Author

thasmo commented Feb 11, 2023

@clementroche, got it - makes sense; I know the "problem". Wish it would be possible tho. 😅

@clementroche clementroche changed the title Native scrolling is blocked/prevented during lenis scroll animation Native scrolling (scrollbar and keyboard) is blocked/prevented during lenis scroll animation Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants