Skip to content

Commit 25eb8cd

Browse files
fix(status-bar): tapping status bar correctly scrolls content to top (#24001)
resolves #20423 Co-authored-by: Hans Krywalsky <EinfachHans@users.noreply.github.com>
1 parent 7010fe9 commit 25eb8cd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

core/src/utils/status-tap.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,21 @@ export const startStatusTap = () => {
1515
const contentEl = el.closest('ion-content');
1616
if (contentEl) {
1717
new Promise(resolve => componentOnReady(contentEl, resolve)).then(() => {
18-
writeTask(() => contentEl.scrollToTop(300));
18+
writeTask(async () => {
19+
20+
/**
21+
* If scrolling and user taps status bar,
22+
* only calling scrollToTop is not enough
23+
* as engines like WebKit will jump the
24+
* scroll position back down and complete
25+
* any in-progress momentum scrolling.
26+
*/
27+
contentEl.style.setProperty('--overflow', 'hidden');
28+
29+
await contentEl.scrollToTop(300);
30+
31+
contentEl.style.removeProperty('--overflow');
32+
});
1933
});
2034
}
2135
});

0 commit comments

Comments
 (0)