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

Smooth scrolling when clicking header links #567

Closed
ulivz opened this issue Jun 10, 2018 · 11 comments · Fixed by #1881 · May be fixed by adamlaska/osmos-cosmos-sdk#5
Closed

Smooth scrolling when clicking header links #567

ulivz opened this issue Jun 10, 2018 · 11 comments · Fixed by #1881 · May be fixed by adamlaska/osmos-cosmos-sdk#5
Labels
contribution welcome Contributions welcome good first issue Good for newcomers type: feature request Request to add a new feature

Comments

@ulivz
Copy link
Member

ulivz commented Jun 10, 2018

Contribution welcome!

@ulivz ulivz added type: feature request Request to add a new feature contribution welcome Contributions welcome labels Jun 10, 2018
@chrtz
Copy link

chrtz commented Jun 13, 2018

Like scrolling back to top?

@ycmjason
Copy link
Contributor

Current header links are using simple anchors. The page jumping is handled by browser.

If we want smooth scrolling, we probably need to implement ourselves.

@chrtz
Copy link

chrtz commented Jun 14, 2018

Ok - for sure I know what smooth scrolling is. Just wanted to get sure, as the issue doesn't have any further description.

I think, this might be the wrong place to ask for this feature as this belongs to the behavior of Vue Router.
And Vue shouldn't (wether it is VuePress, Vue itself or Vue Router) use different approaches.

There are some issues regarding smooth scrolling in the Vue Router repo, but still no final solution as it still would need 3rd party scripts. Nevertheless, there are ways shown to implement it by your own needs.

@meteorlxy
Copy link
Member

That could be a theme-scope consideration. It's better to implement the feature in default theme, but not in core.

@ycmjason
Copy link
Contributor

@chrtz
Don't get me wrong. I am not saying you don't know what smooth scrolling is. I am simply describing what should be done to complete this feature.

I don't think this needs any third-party library or anything to do with Vue router. Since anchor is something native to browser.

@chrtz
Copy link

chrtz commented Jun 14, 2018

@ycmjason no worries. :D just wanted to clarify that I know what you mean.

I just still think this is related to Vue Router as this can handle the scroll behavior.

@ulivz ulivz added the TODO label Aug 20, 2018
@ghost
Copy link

ghost commented Nov 22, 2018

Latest changes have implemented smooth scrolling. However, it comes with several issues:

  • distracting and time wasting when you have a lot of content in one page (go to https://vuepress.vuejs.org/config/#basic-config and click on #evergreen in the sidebar)

  • scrollbar is locked during autoscrolling, making it uncontrollable which is bad UX design

  • even more visual noise due to the interaction with the plugin that updates the anchor in the URL.

Browsing to a specific scroll position is a common task that will happen very often when browsing a documentation and should not involve that much noise (changes in URL, blinking of activated/deactivated sidebar headers, scroll duration) and unusual behavior (locked scrollbar).

There is also an issue that after you opened the page and click on a navbar item, it will highlight the navbar item you clicked on, then highlight the item you are at again (this is the issue) and then toggle through all the items in between while scrolling (inconsistent too when section is small) . This all does not look right.

There needs to be an option to disable smooth scrolling for on-page/cross-page navigation that does not cause inconsistent behavior (see #1016).

@kevindenight
Copy link

kevindenight commented Jan 22, 2019

Yeah, i agree with @matjaeck, it is wasting time when you jump between anchors in a very very long doc.

@deraw
Copy link
Contributor

deraw commented Feb 28, 2019

Maybe this can be configurable and done with scroll-behavior: smooth (See MDN web docs) 🤔

@meteorlxy
Copy link
Member

meteorlxy commented Mar 1, 2019

I've created a small plugin vuepress-plugin-smooth-scroll for this.

But it does not work so well with @vuepress/plugin-active-header-links now.

@staghouse
Copy link

Any movement on this?

@kefranabg kefranabg removed the TODO label Aug 12, 2019
@kefranabg kefranabg added the good first issue Good for newcomers label Sep 20, 2019
meteorlxy added a commit to meteorlxy/vuepress that referenced this issue Sep 22, 2019
ulivz pushed a commit that referenced this issue Sep 23, 2019
* feat($plugin-active-header-links): replace throttle by debounce

* feat($theme-default): use plugin-smooth-scroll (close #567)

* feat($theme-default): smooth-scroll option

* docs: smooth-scroll option of default theme

* docs: enable smooth-scroll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Contributions welcome good first issue Good for newcomers type: feature request Request to add a new feature
Projects
None yet
8 participants