From 0a15c305ab86d18391226d0f721cc812e0d0151f Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Thu, 30 Sep 2021 22:20:45 +0000 Subject: [PATCH] fix(): tapping status bar correctly scrolls content to top --- 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 fbfe4f93c9e..cc25d851c3a 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'); + }); }); } });