Bug 7395 - Touch is not working on Firefox and Chrome
Summary: Touch is not working on Firefox and Chrome
Status: CLOSED WORKSFORME
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Web Access (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.12.0
Assignee: Niko Lehto
URL:
Keywords:
Depends on:
Blocks: 6348 7396
  Show dependency treegraph
 
Reported: 2019-10-09 16:41 CEST by Pierre Ossman
Modified: 2020-04-06 10:50 CEST (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2019-10-09 16:41:10 CEST
Firefox has stopped showing the touch buttons when running on a Windows system with touch support. Tested with Firefox 69 on our Windows 10 laptop.

It must have worked at some point as bug 6348 had issues with the keyboard button with Firefox on Windows.

Also note bug 5882 which had the same issue but for Edge.
Comment 1 Pierre Ossman cendio 2019-10-09 16:44:37 CEST
Check bug 6348 after fixing this as it can most likely be closed.
Comment 2 Pierre Ossman cendio 2019-10-10 12:48:14 CEST
Firefox apparently had problems last time upstream changed the touch detection:

https://github.com/novnc/noVNC/pull/650

Might have been an issue for a long time.
Comment 3 Niko Lehto cendio 2019-10-10 14:22:49 CEST
Touch support completely disabled. Seems to be a bug in Firefox as older versions work. Latest working is Firefox 66. Filed a bug upstream: 

https://bugzilla.mozilla.org/show_bug.cgi?id=1587760
Comment 4 Pierre Ossman cendio 2019-10-16 09:17:30 CEST
So upstream has gotten back to us with the fact that this is intentional. Apparently they see a huge problem with sites assuming that touch means mobile and make the site difficult to use on a desktop machine.

Their solution is to surrender the TouchEvent API to the mobile only domain, and sites that want touch on desktop need to use the newer PointerEvent API. So I guess we'll have to have a look at that. Most browsers support it (even IE!), but unfortunately Safari only does in the latest version. So we probably need to keep some backwards compatibility.

They also claim that Chrome and Edge will also follow this behaviour. Safari is unknown, but touch on macOS doesn't seem to be a big thing anyway.
Comment 5 Pierre Ossman cendio 2019-10-16 09:20:06 CEST
Upstream also claims that we can get the old behaviour back by setting:

dom.w3c_touch_events.enabled = 1
dom.w3c_touch_events.legacy_apis.enabled = true
Comment 6 Niko Lehto cendio 2019-10-21 14:45:32 CEST
(In reply to comment #4)

> They also claim that Chrome and Edge will also follow this behaviour. Safari is
> unknown, but touch on macOS doesn't seem to be a big thing anyway.

Chrome on Unix (touch) seems to follow this behavior now also.
Comment 7 Pierre Ossman cendio 2020-03-09 10:28:09 CET
This PR upstream also affects the touch handing and needs to be considered:

https://github.com/novnc/noVNC/pull/1346
Comment 8 Niko Lehto cendio 2020-03-17 13:45:16 CET
The touch detection is still broken on Firefox 69. These touch events suddenly now works again on Firefox 74 on both windows 10 laptop and desktop.
Comment 9 Niko Lehto cendio 2020-03-17 16:18:56 CET
Filed a question upstream asking if this works as intended or if the recommended way of supporting touch and mouse across all types of devices is still via pointer events. This is described in MDN web docs, and I suspect this still holds true. (https://developer.mozilla.org/en-US/docs/Web/API/Touch_events) 

Wrote the question in the upstream bug I opened a while ago:
https://bugzilla.mozilla.org/show_bug.cgi?id=1587760
and on the related bug thread:
https://bugzilla.mozilla.org/show_bug.cgi?id=1412485
Comment 10 Niko Lehto cendio 2020-03-19 13:58:37 CET
There is still some uncertainties with this from uppstream but what I can discern is:

- The removed legacy support is referring to 'ontouch' and createEvent('TouchEvent') etc.

- addEventListener() with touchstart etc. is still usable. (Works in current Firefox and it is intended) Haven't got any answer yet if this will go away or not.

- Pointer events is recommended by Mozilla and MDN.

- Chrome have done the change to remove 'ontouch' and keep addEventListener while also supporting pointerEvents.

So what I can see is that we can pretty much keep using our code as is, as long Mozilla does not intend to remove addEventListener('touchstart') etc. in the near future. Still waiting for answer from upstream though.
Comment 11 Niko Lehto cendio 2020-04-06 10:50:17 CEST
Mozilla has backed on the changes that caused the problems in this issue, namely the removal of addEventListener('touchstart') support.
Due to this revert the touch now works in Firefox as it should.

Still waiting for response from upstream, but this issue seems to be fixed.

Note You need to log in before you can comment on or make changes to this bug.