While developing a custom website with Angular, I encountered an issue specifically with Safari on iOS. The website is a single-page app with multiple menu sections that trigger a scroll animation when selected using jQuery. Everything was working smoothly on all browsers and platforms except for Safari on iPhone. After changing page sections and initiating the scroll animation, all touch gestures mysteriously stopped functioning on the site. The only way to restore touch gestures was by tapping the Safari address bar or double-tapping anywhere on the screen. This problem did not occur on any desktop browsers or other mobile browsers apart from Safari.
After testing on the Mac iOS simulator, I discovered that the scrolling behavior when toggling between page sections caused the issue. By disabling the scroll animation on mobile devices, the problem vanished:
if(window.innerWidth < 768){
//for mobile
//disable scroll animation
document.body.scrollTop = scrollPos;
}
else{
//use jquery for smooth scrolling on desktop
$([document.documentElement, document.body]).animate({
scrollTop: scrollPos
}, 500);
}
Although I found a workaround, it is not the ideal solution. Additionally, it does not provide an explanation as to why using jQuery to scroll the site results in broken touch gestures on iOS Safari. Any insights on this issue would be greatly appreciated.
For those interested, you can view the website at: www.everythinggoods.studio