Skip to content

Commit

Permalink
fix(status-bar): tapping status bar correctly scrolls content to top (#…
Browse files Browse the repository at this point in the history
…24001)

resolves #20423

Co-authored-by: Hans Krywalsky <[email protected]>
  • Loading branch information
liamdebeasi and EinfachHans authored Sep 30, 2021
1 parent 7010fe9 commit 25eb8cd
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion core/src/utils/status-tap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
}
});
Expand Down

0 comments on commit 25eb8cd

Please sign in to comment.