Bug 222654 - Scrolling in home screen apps incorrectly latches to document
Summary: Scrolling in home screen apps incorrectly latches to document
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: Safari 14
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-03 07:39 PST by Liam DeBeasi
Modified: 2023-07-18 09:38 PDT (History)
5 users (show)

See Also:


Attachments
Code reproduction (5.19 KB, text/html)
2021-03-03 07:39 PST, Liam DeBeasi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Liam DeBeasi 2021-03-03 07:39:29 PST
Created attachment 422079 [details]
Code reproduction

When using an app added to the home screen, scrolling incorrectly latches to #document, making it impossible for users to interact with the app.

Steps to reproduce:

1. Open the attached code reproduction on an iOS device.
2. Add the code reproduction to the home screen and then launch it.
3. Verify that you can scroll the main content.
4. Tap the input and then close the keyboard.
5. Swipe up on the header element.
6. Immediately after this, attempt to scroll on the main content. You should not be able to.

If you were to inspect this using Safari Dev Tools and add a scroll listener, you should notice that the scroll event's target during step 6 is "#document". Sometimes I can get WebKit to re-latch to the main content, but I am not sure what causes that to happen.


Expected Behavior:

I would expect WebKit to never latch to #document for scrolling and continue to latch to the main content.


Actual Behavior:

WebKit latches to the #document for scrolling.


Additional Information:
- This was tested on iOS 14.5, but I can reproduce this on earlier versions of iOS 14.
- This only happens when the app is installed to the homescreen. Running this in Safari does not reproduce the issue.
- This does not happen when running the app inside of WKWebView in a Capacitor or Cordova application.
Comment 1 Simon Fraser (smfr) 2021-03-03 10:12:50 PST
I believe there are two issues here:
1. the document is scrollable on home screen web apps when it should not be (bug 214781)
2. UIKit has a bug where, if an ancestor scroll view is rubber banding, you have to wait for it to stop before you can scroll the inner scroll view (tracked internally).
Comment 2 Radar WebKit Bug Importer 2021-03-10 07:40:16 PST
<rdar://problem/75264303>
Comment 3 Lincoln Baxter, III 2022-06-03 06:24:50 PDT
Any updates on this? We are struggling to control the very strange user interactions this causes on our full-page website.
Comment 4 tgels 2022-07-01 03:04:36 PDT
This bug is impacting the user experience for many webkit users worldwide that are using PWA's. Can we expect any progress on fixing this issue in the (near) future?
Comment 5 alex 2023-06-26 07:35:18 PDT
Hi there! This impact me, too. Video here:

https://github.com/ionic-team/ionic-framework/issues/27697
Comment 6 alex 2023-07-06 15:00:30 PDT
Hi there.

Sorry for the dupe comment. I just wanted to relay that this issue has been reported to me more times than I can count *just in the past 48 hours* by users of wefwef (https://wefwef.app).

It's even worse that I previously thought. Any time the user tries to swipe during a page transition where pointer events are disabled, Safari will latch scroll to the document.

Users then try to scroll the feed once the animation is complete, but they're stuck! The latching time is also juuuust long enough that users don't wait enough for it to unlatch, and they think the page is frozen.

Here's a few users in the wild complaining about this very specific bug from the last *60 minutes*:

> Scrolling also sometimes gets “frozen” briefly when returning to my feed. This happen to anyone else?

> Yes to the freezing. It needs a second or two before you can scroll.

Resolving this is really important for webapps installed to the homescreen.
Comment 7 Lincoln Baxter, III 2023-07-18 09:38:34 PDT
Yep, this is still a major issue in 2023. We've implemented a number of hacks to make this occur less frequently, but they are indeed hacks.