Skip to content
This repository was archived by the owner on Sep 28, 2023. It is now read-only.

Conversation

@Rakonda
Copy link

@Rakonda Rakonda commented Oct 26, 2020

Add a scroll behavior to the window.scrollTo(), by default the behavior is auto, giving an extra option for smooth-scroll would be nice.

Add scroll behavior to the window.scrollTo(), by default the behavior is auto, giving an extra option for smooth-scroll would be nice.
@Rakonda Rakonda closed this Oct 26, 2020

public ScrollToTop() {
window.scrollTo(0, 0);
window.scrollTo(0, 0, behavior);
Copy link
Member

@Lausselloic Lausselloic Oct 26, 2020

Choose a reason for hiding this comment

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

looks like it's not the way to pass behavior option to scrollTo function
Maybe try : scrollTo({ top:0, left:0, behavior: this.behavior })

Copy link
Member

Choose a reason for hiding this comment

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

and it's not IE compliant, and iOS doesn't have smooth effect https://developer.mozilla.org/fr/docs/Web/API/ScrollToOptions

Need to check if it comply with accessibility rules too

Copy link
Author

Choose a reason for hiding this comment

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

That is why i closed this MR, missing the This.

Copy link
Member

Choose a reason for hiding this comment

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

You can update this PR and fix errors by pushing more commits to your branch

@Lausselloic Lausselloic reopened this Oct 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants