vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

feat: smooth scroll and prefs

Open userquin opened this issue 3 years ago • 1 comments

POC: by default smooth scroll not enabled and we can remove it from the configuration, enabled by default (I need to change the docs).

From the comments here https://github.com/vuejs/vitepress/pull/978#issuecomment-1183549569, it seems there are some caveats with the implementation in all browsers:

  • chrome: just works, but scrolling from the right aside links seems to not work; from the left aside seems to work
  • firefox: ~~not working; we can add a manual focus using scrollIntoView in the right aside, we'll need to include behavior: 'smooth' (tested but removed, see safari)~~ check next comment
  • safari: smooth not supported

userquin avatar Jul 16 '22 22:07 userquin

It seems Firefox is using smooth scroll when the target is close, if the distance exceeds some threshold it will apply normal behavior.

EDIT: why not just open an issue on Chrome?

userquin avatar Jul 17 '22 09:07 userquin

Closing due to inactivity. The PR becoming obsolete 😓

kiaking avatar Jan 20 '23 19:01 kiaking