From 7868ebc5c8895a55a8f9b65340578a3038b47d2c Mon Sep 17 00:00:00 2001 From: gitstart-storybook Date: Wed, 24 May 2023 04:36:31 +0000 Subject: [PATCH] fix: scroll location persist between docs --- code/lib/preview-api/src/modules/preview-web/WebView.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/lib/preview-api/src/modules/preview-web/WebView.ts b/code/lib/preview-api/src/modules/preview-web/WebView.ts index fa6a823bb0ba..6f02568934c3 100644 --- a/code/lib/preview-api/src/modules/preview-web/WebView.ts +++ b/code/lib/preview-api/src/modules/preview-web/WebView.ts @@ -84,6 +84,10 @@ export class WebView implements View { this.showMain(); this.showDocs(); this.applyLayout('fullscreen'); + + document.documentElement.scrollTop = 0; + document.documentElement.scrollLeft = 0; + return this.docsRoot(); }