fix(status-bar): tapping status bar correctly scrolls content to top (#24001)

resolves #20423

Co-authored-by: Hans Krywalsky <EinfachHans@users.noreply.github.com>
This commit is contained in:
Liam DeBeasi
2021-09-30 18:37:47 -04:00
committed by GitHub
parent 7010fe97a7
commit 25eb8cdf98

View File

@ -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');
});
});
}
});