From 1b804cd0dd7480bb7067f577ab789d18c5f669bc Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Sun, 12 Nov 2023 10:20:13 +0000 Subject: [PATCH] sponsorship: Don't preserve scroll position on reload. --- web/src/billing/sponsorship.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/src/billing/sponsorship.ts b/web/src/billing/sponsorship.ts index 6a569c5be5..44af76f1d9 100644 --- a/web/src/billing/sponsorship.ts +++ b/web/src/billing/sponsorship.ts @@ -97,5 +97,14 @@ export function initialize(): void { } $(() => { + // Don't preserve scroll position on reload. This allows us to + // show the sponsorship pending message after user submits the + // form otherwise the sponsorship pending message is partially + // hidden due to browser preserving scroll position. + // https://developer.mozilla.org/en-US/docs/Web/API/History/scrollRestoration + if (history.scrollRestoration) { + history.scrollRestoration = "manual"; + } + initialize(); });