From 22006e8d6e3ed45841979d684eb6a4ef999bd707 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 8 Jul 2022 22:07:37 +0530 Subject: [PATCH] fix: decode href before using as query selector (#951) --- src/client/theme-default/components/VPDocAsideOutline.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/theme-default/components/VPDocAsideOutline.vue b/src/client/theme-default/components/VPDocAsideOutline.vue index b4b17908..58ebe838 100644 --- a/src/client/theme-default/components/VPDocAsideOutline.vue +++ b/src/client/theme-default/components/VPDocAsideOutline.vue @@ -22,7 +22,9 @@ const resolvedHeaders = computed(() => { function handleClick({ target: el }: Event) { const id = '#' + (el as HTMLAnchorElement).href!.split('#')[1] - const heading = document.querySelector(id) as HTMLAnchorElement + const heading = document.querySelector( + decodeURIComponent(id) + ) as HTMLAnchorElement heading?.focus() }