Fix broken querySelectors on techdocs

This change fixes the broken pattern for selecting DOM elements to scroll to.

Previously it had error messages like so:
```
Uncaught DOMException: Failed to execute 'querySelector' on 'Element': '#fn:someidtag' is not a valid selector.
```

This did not bode well with the techdocs integration with footnotes.

The query has now changed to include something that is expected by the DOM queries.

Signed-off-by: Nicolas Arnold <nic@roadie.io>
This commit is contained in:
Nicolas Arnold
2022-03-21 17:35:53 +00:00
parent 6836c399c4
commit f0fb9153b7
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs': patch
---
Fix broken query selectors on techdocs
@@ -803,7 +803,7 @@ export const useTechDocsReaderDom = (
navigate(`${parsedUrl.pathname}${parsedUrl.hash}`);
// Scroll to hash if it's on the current page
transformedElement
?.querySelector(`#${parsedUrl.hash.slice(1)}`)
?.querySelector(`[id='${parsedUrl.hash.slice(1)}']`)
?.scrollIntoView();
}
} else {