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:
committed by
GitHub
parent
44febdd87a
commit
2aab54319e
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user