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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user