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

scroll-margin / scroll-padding are not taken into account #196

Open
Voltra opened this issue Jun 26, 2023 · 2 comments
Open

scroll-margin / scroll-padding are not taken into account #196

Voltra opened this issue Jun 26, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Voltra
Copy link

Voltra commented Jun 26, 2023

Describe the bug
When using Lenis#scrollTo to scroll to an element, the scroll-margin and/or scroll-padding properties are ignored, thus making it scroll beyond the desired point.

To Reproduce
This minimal codepen.

Desired Behavior

scroll-margin and scroll-padding should be used when determining where to stop scrolling (like the native Element#scrollIntoView does).

@clementroche clementroche added the enhancement New feature or request label Jun 27, 2023
@clementroche
Copy link
Member

clementroche commented Jun 27, 2023

This is a good idea however it has an huge impact on performance since it requires getComputedStyle(). For that reason i don't want to include it by default in the package but you can do it by yourself using scrollTo(value,{offset: scrollMarginValue}).

@Voltra
Copy link
Author

Voltra commented Jun 28, 2023

Gotcha, maybe in the future we could have a flag in the constructor to enable automating this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants