fix: permalink scroll for enumerated anchors

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2022-03-18 15:08:36 +01:00
parent f6a50ace9c
commit f90ffdc84e
@@ -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;