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
feat(theme-default): subtitle automatically appears in the view when it overflows the visual area #698
feat(theme-default): subtitle automatically appears in the view when it overflows the visual area #698
Conversation
…it overflows the visual area change code styles
Wait... Does it work with sidebar group or even nested sidebar group? Since each sidebar group will have a sideLinks as children, there might be mutiple components in a single sideabr |
Yes, I have tested the case, there might are many active sidebars but only one of them whose href is completely match both path and hash of the page. And the code will find this one and let it scrollIntoView. const activeSidebarItem = document.querySelector(
`[href="${router.currentRoute.value.path}${router.currentRoute.value.hash}"]`
) |
packages/@vuepress/theme-default/src/client/components/SidebarItems.vue
Outdated
Show resolved
Hide resolved
packages/@vuepress/theme-default/src/client/components/SidebarItems.vue
Outdated
Show resolved
Hide resolved
packages/@vuepress/theme-default/src/client/components/SidebarItems.vue
Outdated
Show resolved
Hide resolved
…-lx/vuepress-next into feat-theme-default-sidebar-autoscroll
close #658
When I scroll markdown content, I need to swipe sidebar to see the corresponding subtitle if the current subtitle is too far behind:
This PR will realize the function that the page content scrolls, if the active subtitle overflows the visual area, it will automatically scroll to the visual area. The effect is shown in GIF below: