window.scrollTo and iOS status bar

window.scrollTo works well in most situations on mobile safari, except when the iOS status bar is tapped.

When the status bar is tapped, the page scrolls to the top and url bar is shown, then window.scrollTo doesn’t work anymore.

You can try it by


The url bar will not hide after tapping the status bar because window.scrollTo is disabled.

To re-enable it, either:

  1. User scrolls the page, or
  2. Trigger window.scrollTo by user interaction, such as click and touchend