Bug 226848

Summary: Touch events lost when a PWA goes into the background
Product: WebKit Reporter: Joshua Grass <joshua.grass>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: appleipadbetatester, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: Unspecified   
OS: Unspecified   

Description Joshua Grass 2021-06-09 13:41:41 PDT
Progressive web apps that use:

document.addEventListener('touchstart', mantaTouchStart, false);

and other touch events lose the event listener when the application is put in the background and brought back to the foreground.

To reproduce:
1) Open a web page that uses a touch event (touchStart, touchEnd, touchMove...)
2) Touch events work fine
3) Go to the home screen - placing Safari in the background
4) go back to safari
5) touch events continue to work
6) Add the website to the homescreen
7) Open the PWA
8) Touch events work fine
9) Go the the home screen - placing the PWA in the background
10) Go back to the PWA
11) touch events no longer respond

Update still happens, so I've even tried adding code to re-add the touch listeners as part of the update.  That does not work either.  So I think, it is beyond just losing the touch event listener.  I think something has broken them when you switch to another app and back.

Touch events work fine in safari and work fine on android when a chrome web page is saved as a PWA, so I do not think it is developer error.
Comment 1 Radar WebKit Bug Importer 2021-06-16 13:42:18 PDT
<rdar://problem/79413969>