mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
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:
@ -15,7 +15,21 @@ export const startStatusTap = () => {
|
|||||||
const contentEl = el.closest('ion-content');
|
const contentEl = el.closest('ion-content');
|
||||||
if (contentEl) {
|
if (contentEl) {
|
||||||
new Promise(resolve => componentOnReady(contentEl, resolve)).then(() => {
|
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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user