-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
themeRelated to the themeRelated to the theme
Description
Is your feature request related to a problem? Please describe.
layoutshifts.webm
Layout shifts happens for devices with width 960px - 1280px. This is caused by the LocalNav injected on client side.
Describe the solution you'd like
I'm not sure. I took a look but didn't find an easy way to solve this.
This empty
class is set on SSR because
empty: !hasLocalNav.value, |
hasLocalNav
is always false
on SSR.vitepress/src/client/theme-default/composables/layout.ts
Lines 55 to 57 in 318c14f
const hasLocalNav = computed(() => { | |
return headers.value.length > 0 | |
}) |
This is
true
for most pages on client render because it is set here.headers.value = getHeaders(frontmatter.value.outline ?? theme.value.outline) |
But this function checks the rendered document. I don't know a way to achieve this on SSR.
Maybe adding
isSSR ||
here, assuming most pages has headers?v-if="!isHome && (hasLocalNav || hasSidebar || y >= navHeight)" |
Describe alternatives you've considered
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the docs.
- Read the Contributing Guidelines.
- Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.
Metadata
Metadata
Assignees
Labels
themeRelated to the themeRelated to the theme