From 25eb8cdf98fe455433ca6185e89d9e1223a6d3ae Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Thu, 30 Sep 2021 18:37:47 -0400 Subject: [PATCH] fix(status-bar): tapping status bar correctly scrolls content to top (#24001) resolves #20423 Co-authored-by: Hans Krywalsky --- core/src/utils/status-tap.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/src/utils/status-tap.ts b/core/src/utils/status-tap.ts index fbfe4f93c9..cc25d851c3 100644 --- a/core/src/utils/status-tap.ts +++ b/core/src/utils/status-tap.ts @@ -15,7 +15,21 @@ export const startStatusTap = () => { const contentEl = el.closest('ion-content'); if (contentEl) { new Promise(resolve => componentOnReady(contentEl, resolve)).then(() => { - writeTask(() => contentEl.scrollToTop(300)); + writeTask(async () => { + + /** + * If scrolling and user taps status bar, + * only calling scrollToTop is not enough + * as engines like WebKit will jump the + * scroll position back down and complete + * any in-progress momentum scrolling. + */ + contentEl.style.setProperty('--overflow', 'hidden'); + + await contentEl.scrollToTop(300); + + contentEl.style.removeProperty('--overflow'); + }); }); } });