From f90ffdc84e1c5f48fee0df3081a92399fdfbe983 Mon Sep 17 00:00:00 2001 From: Camila Belo Date: Fri, 18 Mar 2022 15:08:36 +0100 Subject: [PATCH] fix: permalink scroll for enumerated anchors Signed-off-by: Camila Belo --- plugins/techdocs/src/reader/transformers/scrollIntoAnchor.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/techdocs/src/reader/transformers/scrollIntoAnchor.ts b/plugins/techdocs/src/reader/transformers/scrollIntoAnchor.ts index 0fa977865e..7ba02bcdfc 100644 --- a/plugins/techdocs/src/reader/transformers/scrollIntoAnchor.ts +++ b/plugins/techdocs/src/reader/transformers/scrollIntoAnchor.ts @@ -22,7 +22,8 @@ export const scrollIntoAnchor = (): Transformer => { // Scroll to the desired anchor on initial navigation if (window.location.hash) { const hash = window.location.hash.slice(1); - dom?.querySelector(`#${hash}`)?.scrollIntoView(); + // fix invalid selector error for anchor starting with number + dom?.querySelector(`[id="${hash}"]`)?.scrollIntoView(); } }, 200); return dom;