Skip to content

feat: Auto-anchor the sidebar to the active item#5194

Open
Lukoning wants to merge 1 commit into
vuejs:mainfrom
Lukoning:main
Open

feat: Auto-anchor the sidebar to the active item#5194
Lukoning wants to merge 1 commit into
vuejs:mainfrom
Lukoning:main

Conversation

@Lukoning

@Lukoning Lukoning commented May 1, 2026

Copy link
Copy Markdown

Description

  1. 让侧边栏可以自动定位到当前页面所对应的链接
  2. 在窗口大小变化时,将当前页链接保持在侧边栏可视区域中央
  3. 用户手动滚动侧边栏后,没有切换路由、刷新页面、重新打开侧边栏,且侧边栏内容未变化时,禁用自动定位,以提升用户体验

  1. Enable the sidebar to automatically scroll to the link corresponding to the current page.
  2. When the window size changes, keep the current page link centered within the sidebar's visible area.
  3. After the user manually scrolls the sidebar, disable auto-positioning (to improve user experience) unless the route changes, the page is refreshed, the sidebar is reopened, or the sidebar content changes.

Linked Issues

#3426 #4296 #4345 #4579

Additional Context

注意到2024年已经有人提过类似PR:
Note that similar PRs have already been proposed in 2024:

#3654 #3901


Tip

The author can publish a preview release by commenting /publish after creating the PR.

@Lukoning

Lukoning commented May 1, 2026

Copy link
Copy Markdown
Author
2026-05-01.18-11-10.mp4

Lukoning added a commit to Lukoning/lukoning.github.io that referenced this pull request May 1, 2026
1. 切换包管理器为pnpm,更新相应文件和README
2. 完善CDocInfo.vue,完善版权声明,并对文档头部区域做了美化
3. 侧边栏滚动更新,并额外对os做了适配。见: github.com/vuejs/vitepress/pull/5194
4. LocalNav标题新增动画
5. 更新小说《磊水》
6. 样式修改,主要更改了背景遮罩颜色,以提高可读性
@github-actions github-actions Bot added the stale label Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant