Skip to content

Pass through extra arguments to scrollTo #2069 #2096

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

Closed
wants to merge 2 commits into from
Closed

Pass through extra arguments to scrollTo #2069 #2096

wants to merge 2 commits into from

Conversation

nurdism
Copy link

@nurdism nurdism commented Mar 9, 2018

This is a PR for issue #2069
Adds smooth scrolling option to scrollBehavior position.

Adds smooth scrolling option to scrollBehavior position
@posva
Copy link
Member

posva commented Mar 9, 2018

Thanks for the PR but It will be better to pass any extra arguments to build up an object, so the user can pass the original behaviour function. Also, it should be able to still call the old two parameters functions in browser not supporting it

@nurdism
Copy link
Author

nurdism commented Mar 9, 2018

So your saying something like this or did I miss understand your comment?

@posva
Copy link
Member

posva commented Mar 9, 2018 via email

@nurdism
Copy link
Author

nurdism commented Mar 9, 2018

I'm wondering if it would be better to wrap it with a try { } catch { } rather than the method I used. That way it would work on older browsers if you include the polyfill, thoughts?

@posva posva changed the title Implements issue #2069 Pass through extra arguments to scrollTo #2069 Jun 22, 2018
@GustavoNunes
Copy link

Hi there! It would be nice if this PR gets merged, is something holding this back?

I can help if needed (was going to submit a PR but found this one).
Thanks!

window.scrollTo(position.x, position.y)
const docEl: any = document.documentElement
if ('scrollBehavior' in docEl.style) {
window.scrollTo({ top: position.y, left: position.x, behavior: isObject && typeof shouldScroll.behavior === 'string' ? shouldScroll.behavior : 'auto' })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do

behavior:  (isObject && shouldScroll.behavior) || 'auto'

the user should be responsible for passing the correct type of value

@posva
Copy link
Member

posva commented May 27, 2020

There is a problem with the repository so I will add the change locally

@posva posva closed this May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants