From 2c3ae629e1c3e7d9f44284c4e15c29f10b92140b Mon Sep 17 00:00:00 2001 From: Karsa Date: Mon, 8 May 2023 08:47:34 +0200 Subject: [PATCH] Fixes event target error for categorylistitems --- docs/.vitepress/theme/components/icons/CategoryListItem.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/.vitepress/theme/components/icons/CategoryListItem.vue b/docs/.vitepress/theme/components/icons/CategoryListItem.vue index 1cbc378b1..9472a2c73 100644 --- a/docs/.vitepress/theme/components/icons/CategoryListItem.vue +++ b/docs/.vitepress/theme/components/icons/CategoryListItem.vue @@ -23,7 +23,8 @@ const props = defineProps<{ const { selectedCategory } = useCategoryView() function onClick(event: Event) { - const id = '#' + (event.target as HTMLAnchorElement).href!.split('#')[1] + const target = (event.target as HTMLElement).nodeName === 'span' ? (event.target as HTMLElement).parentNode : event.target as HTMLElement + const id = '#' + (target as HTMLAnchorElement).href!.split('#')[1] const decodedId = decodeURIComponent(id) selectedCategory.value = decodedId.replace('#', '')