techdocs: reset scroll position on page navigate (#5018)

Signed-off-by: Chongyang Adrian, Ke <ftt.adrian.ke@grabtaxi.com>

Co-authored-by: Chongyang Adrian, Ke <ftt.adrian.ke@grabtaxi.com>
This commit is contained in:
Adrian Ke Chongyang
2021-03-22 23:42:49 +08:00
committed by GitHub
parent 44febdd87a
commit 2aab54319e
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs': patch
---
TechDocs: links at sidebar and bottom reset scroll position to top
@@ -113,6 +113,7 @@ export const Reader = ({ entityId, onReady }: Props) => {
addLinkClickListener({
baseUrl: window.location.origin,
onClick: (_: MouseEvent, url: string) => {
window.scroll({ top: 0 });
const parsedUrl = new URL(url);
if (parsedUrl.hash) {
history.pushState(