core icon indicating copy to clipboard operation
core copied to clipboard

[Bug report] Links with anchors don't scroll to the correct position *the first time*

Open smirnoffmv opened this issue 1 year ago • 3 comments

Description

When I open the anchor link and the page content is too big, it doesn't scroll to the end! If you go back and click on the same link again, it works fine.

When I click on the anchor link for the first time, I get to the wrong place. In the wrong place at all

bug1

bug2

If I click on the back arrow in the browser and click on the same link again, I will already get there correct. Apparently the page has already loaded for the second time

bug3

A similar problem has already been discussed here, and apparently has not been solved: https://github.com/vuejs/vuepress/issues/1499

Reproduction

https://help.stack-it.ru/web/ul/160_web_tk_ul_raschotd-master/130_web_tk_ul_energy/4_wk_diff_tar.html#расчет-точек-учета-ику-в-договорах-на-ресурс

Used Package Manager

npm

System Info

Environment Info:

  System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12400
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 10.4.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Chromium (123.0.2420.65)
  npmPackages:
    @vuepress/core:  2.0.0-rc.7
    @vuepress/theme-default: Not Found
    vuepress: ^2.0.0-rc.7 => 2.0.0-rc.7
  npmGlobalPackages:
    vuepress: Not Found

smirnoffmv avatar Mar 29 '24 05:03 smirnoffmv

I will try if https://github.com/typesense/typesense-website/commit/48170484e14598d06baa448f0c5533f8bb3a8a97#diff-2d43cf89606a96dc1e5a75a023d3d30190e998b5abd19c2eae2179f25053b28bR75-R100 works

Ref: https://router.vuejs.org/guide/advanced/scroll-behavior.html#Scroll-Behavior

Edited: It seems that it should be fixed inside vuepress/core

Mister-Hope avatar Apr 07 '24 16:04 Mister-Hope

BTW, I am not reproducing your issue with your reproduction link when I clear my cache and choose "Slow 3G" in network panel.

Mister-Hope avatar Apr 07 '24 16:04 Mister-Hope

Yes, with this setting, the anchor transition works correctly, but do not turn on this preset all the time)

smirnoffmv avatar Apr 08 '24 07:04 smirnoffmv