Skip to content

Feature Request: ability to "continue" scrolling if needed #140

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

Open
matthew-dean opened this issue Jul 18, 2018 · 2 comments
Open

Feature Request: ability to "continue" scrolling if needed #140

matthew-dean opened this issue Jul 18, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@matthew-dean
Copy link

One of the things I wish I could do is alter the scrolling mechanism or skipping elements to scroll based on certain conditions, but the side-effect of attaching a function to behavior is that it effectively interrupts all scrolling. It would be nice to alter the list of elements to scroll, and where they will scroll to, but then pass the action back to the library, since it already polyfills smooth scrolling. Otherwise, if I use behavior: Function, then I have to additionally polyfill smooth scrolling, even though it's polyfilled in your library internally. It would be nice to say back to scrollIntoView, "yes, continue scrolling this and this element smoothly, although change element 2's eventual scroll position. And no, don't scroll element 3." And then the magic just continues from there.

@matthew-dean
Copy link
Author

I think what you should probably do is, rather than have a function as behavior, leave the other values for behavior and then have something like beforeScroll with the entries. Returning true should just execute normal behavior. Returning an object should change what is scrolled and to what scroll values.

@stipsan stipsan added the enhancement New feature or request label Jul 18, 2018
@stipsan
Copy link
Member

stipsan commented Jul 18, 2018

This is something I've wanted as well. It's mentioned shortly after the initial v2 release:

For those who want to skip some overflow elements, but not all, I plan on introducing another callback option for that, similar to options.boundary where you can make your own assertions and decide what should count as a scrolling box or not.

It would be super nice to just be able to skip certain elements and have everything just work™ instead of needing to reimplement so much functionality. This feature would belong in compute-scroll-into-view though, to ensure the scrolling coordinates are correct when elements are skipped.

Instead of calling it beforeScroll how about shouldScroll?

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