From f7739173327f2f4600a7b63fad19f3a4c6ec2f52 Mon Sep 17 00:00:00 2001 From: userquin Date: Wed, 10 Sep 2025 21:26:21 +0200 Subject: [PATCH] fix(theme): skip link jumps to aside instead main content heading/anchor --- src/client/theme-default/components/VPSkipLink.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/theme-default/components/VPSkipLink.vue b/src/client/theme-default/components/VPSkipLink.vue index ad56622d..10c987e4 100644 --- a/src/client/theme-default/components/VPSkipLink.vue +++ b/src/client/theme-default/components/VPSkipLink.vue @@ -10,10 +10,12 @@ const backToTop = ref() watch(() => route.path, () => backToTop.value.focus()) function focusOnTargetAnchor({ target }: Event) { - const el = document.getElementById( + const targetEl = document.getElementById( decodeURIComponent((target as HTMLAnchorElement).hash).slice(1) ) + const el = targetEl?.querySelector('main h1[id][tabindex="-1"]') ?? targetEl + if (el) { const removeTabIndex = () => { el.removeAttribute('tabindex')