When I swipe down in the Telegram web app, the window closes. I found an example of how this was handled in another application: when swiping, an empty space appears, and instead of closing the curtain, the application scrolls up. The larger I make this space, the more acceleration there is in the scroll, and the less intense swipes are needed to go beyond the edge of the application. If this space is not large enough, with strong swipes, the application closes. Here is my implementation:
<html lang="en">
<body>
<div id="scrollArea" style="margin-top: 0px;"></div>
...
</body>
<script>
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
var scrollArea = document.querySelector("#scrollArea")
scrollArea.style.marginTop = "280px";
scrollArea.style.paddingBottom = "20px";
scrollToTop();
window.addEventListener('scroll', function () {
if (window.scrollY < 280) {
scrollToTop();
}
});
}
function scrollToTop() {
document.body.scrollTop = 0;
setTimeout(() => {
window.scroll({top: 300, behavior: "instant"});
}, 50);
}
</script>
</html>
Here is an example of how it works (only works on iOS) @unicorn_go_bot
Any ideas how can i handle it?