Winit: wasm: `Touch` events not received on Android browsers

Created on 25 Nov 2019  路  9Comments  路  Source: rust-windowing/winit

Particularly Android Firefox. Example: https://alopex.li/temp/g11/ I tap away and it does nothing. Not sure what touch events would be for if not for this.

Android Chrome seems to turn taps into WindowEvent::MouseInput events, but Firefox does not. Not sure how to investigate this further, since I know little about mobile dev and little about webdev and so the Venn diagram of what I know about the two together is vanishingly small.

WebAssembly needs investigation bug

Most helpful comment

Hey I think I might be able to help, with some information.

It looks like you are talking about different events here without noticing. The touch-start events and friends have never been a problem for me on mobile FF, this works fine. The problem with mobile FF is with the pointer-move events and friends. As you can see at canisuse you have to enable these events on FF for Android. (Requires dom.w3c_pointer_events.enabled = true)

The pointer events are supposed to combine mouse and touch events. Ideally, if all browsers implemented them, touch and mouse events could be ignored and only pointer events need to be considered. That's what quicksilver still does as of 0.3.18, I believe. And from skimming through winit code for five minutes I get the impressions it is done the same way.

So in my expertise, you can probably get JS touch events on a mobile FF but these are not propagated by winit.

All 9 comments

Hm, this is something that completely slipped my mind but I already knew about: https://github.com/ryanisaacg/quicksilver/pull/527. This is because Firefox Mobile apparently doesn't support Touch events, though caniuse seems to indicate a recent release does.

Can you share your mobile browser version?

Firefox 68.2.1. Thought it was newer than that actually! Still looks like it should be supported though.

I whipped up a quick test:

https://jsfiddle.net/au0qxjmo/

Does this print touch events in Firefox? (If it doesn't, I'm curious if it does in Chrome)

Touch events work in the modern/new Firefox on my android here.
And in Chrome on android.
Doesn't work in the older pre-quantum firefox on android here though.

I used this as the jsfiddle instead though so I didn't have to hook up a console over USB:
https://jsfiddle.net/bxL5qsm7/

Hey I think I might be able to help, with some information.

It looks like you are talking about different events here without noticing. The touch-start events and friends have never been a problem for me on mobile FF, this works fine. The problem with mobile FF is with the pointer-move events and friends. As you can see at canisuse you have to enable these events on FF for Android. (Requires dom.w3c_pointer_events.enabled = true)

The pointer events are supposed to combine mouse and touch events. Ideally, if all browsers implemented them, touch and mouse events could be ignored and only pointer events need to be considered. That's what quicksilver still does as of 0.3.18, I believe. And from skimming through winit code for five minutes I get the impressions it is done the same way.

So in my expertise, you can probably get JS touch events on a mobile FF but these are not propagated by winit.

I believe this issue is now obsolete on master since the web-sys backend supports mouse events as a fallback (and now that the old Firefox is going away). Can this be closed?

I have been dabbling with touch controls a bit now, through mrk-its/bevy_webgl2.

With a simple css property on the canvas (touch-action: none), the CursorMoved event seems to work fine. Even for multitouch if you use the device_id!

_However..._
IMHO, as long as winit differentiates between Touch and Mouse events, they should be kept separate.
I assume Touch works on the android/ios platforms. Having to handle touch differently on native android and web android seems... wrong?

See #1673, proper touch events on web is not yet implemented.

From what I understand this issue is about the mouse events synthesized from touch and not actual touch events.

Ah right, this firefox-specific issue is probably not a problem anymore. I got hung up on the title.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomaka picture tomaka  路  3Comments

felixrabe picture felixrabe  路  4Comments

swiftcoder picture swiftcoder  路  3Comments

dhardy picture dhardy  路  3Comments

francesca64 picture francesca64  路  5Comments