Bug 253416

Summary: Clicks aren't registered in iOS Safari in Wasm game
Product: WebKit Reporter: eri0onpm
Component: CanvasAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, eknoor, karlcow, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 16   
Hardware: iPhone / iPad   
OS: iOS 16   
URL: https://ericoporto.github.io/agsjs/fix/

Description eri0onpm 2023-03-05 14:38:48 PST
https://ericoporto.github.io/agsjs/fix/

The game in this link register touches correctly in Google Chrome on Android and also Firefox on Android, but not on Safari on iOS.

There is no exceptions or errors registered in the Safari console.

As far as I can tell the touch events should work the same in iOS Safari.
Comment 1 Radar WebKit Bug Importer 2023-03-12 15:39:14 PDT
<rdar://problem/106621669>
Comment 2 eri0onpm 2023-03-18 03:18:56 PDT
I am using regular Emscripten methods, but I know their CI only tests for Chromium and Firefox, so my guess is there's some incompatibility between that and Safari, or some missing API in Safari. Any help in figuring this out would be greatly appreciated.
Comment 3 eri0onpm 2023-03-18 18:07:08 PDT
Found the issue, Touch.identifier works differently in iOS Safari and there was some internal reliance on how it works on the other devices, os and browsers.
Comment 4 Eknoor 2023-04-10 21:17:01 PDT
Thank you for the update on your findings. Does this report still need to remain open?
Comment 5 Karl Dubost 2023-04-10 21:58:42 PDT
eri0onpm,

Are you referring to the code in this script:
in https://ericoporto.github.io/agsjs/fix/ags.js

I loaded the game on iPad (large) and it's not working at all.



> Touch.identifier works differently in iOS Safari 

In which way? Could you provide a minimal test case?



https://w3c.github.io/touch-events/#dom-touch-identifier

> An identification number for each touch point.
> 
> When a touch point becomes active, it must be assigned an identifier that is distinct from any other active touch point. While the touch point remains active, all events that refer to it must assign it the same identifier.
Comment 6 eri0onpm 2023-07-30 15:31:26 PDT
sorry, I never saw the last message, but yes, it was fixed on our end, here is the PR that fixed this

https://github.com/adventuregamestudio/ags/pull/1955

The touch finger IDs in iOS they always get a new integer number, in Android browsers they work differently, being first finger the number 0, second finger on screen the number 1, and when a finger is removed from screen the next finger will get its ID or whatever is the lower available ID. Both comply with the spec for the Web as the way this is phrased in the spec is mostly "have an unique ID for a finger".