Reputation: 852
I used a simple test on a windows 7 desktop with touch capabilities. For simplicity it was something like this:
temp_div.addEventListener('touchstart', function(e){ /*confirm */ }, false)
temp_div.addEventListener('pointerdown', function(e){ /*confirm */ }, false)
temp_div.addEventListener('mousedown', function(e){ /*confirm */ }, false)
In chrome, the 'touchstart' was confirmed. In IE, the 'pointerdown' was confirmed. In Firefox, the 'mousedown' was confirmed.
After troubleshooting, I ultimately had to go to 'about:config' in Firefox and change the 'dom.w3c_touch_events.enabled' value from 0 to 1. This caused the 'touchstart' to be confirmed in Firefox.
My questions are these:
Shouldn't this have already been enabled on a touch-capable machine? IE and Chrome were configured properly and Firefox was not. (This was a brand new download of Firefox 31).
Is there anyway to enable touch events remotely in a case like this so that Firefox behaves similarly to the other browsers?
Thanks
Upvotes: 14
Views: 21049
Reputation: 5016
There is a dom.w3c_touch_events.legacy_apis.enabled
events configuration option in Firefox 72. It is off by default. Turning it on helps some websites with touch-based drag and drop. Atlassian Jira in particular.
Upvotes: 1
Reputation: 3440
Touch events are not working in Firefox currently (version 48.0.1) but it is possible to enable pointer events by browsing to about:config and setting dom.w3c_pointer_events.enabled to true. The event object passed to your handler will contain a pointerType property with the value of "touch" if it was a touch event.
See: https://mobiforge.com/design-development/html5-pointer-events-api-combining-touch-mouse-and-pen
Upvotes: 2
Reputation: 852
In order to enable touch events in the desktop version of Firefox, type "about:config" into the address bar of the browser, click the "I'll be careful, I promise!" button and scroll down until you find "dom.w3c_touch_events.enabled" ....when you click this item, a dialog box will appear that allows you to change the value of the setting.
disable=(0) enable=(1) auto-detect=(2)
This should be set to "auto-detect" by default, but currently, the desktop version of Firefox is set to "disable" due to some bugginess.
Info about this setting can be found here: https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Touch_events
excerpt:
The dom.w3c_touch_events.enabled tri-state preference can be used to disable (0), enable(1), and auto-detect(2) support for standard touch events; by default, they're on auto-detect(2). After changing the preference, you must restart the browser for the changes to take effect.
Note: As of Gecko 24.0, the touch events support introduced with Gecko 18.0 has been disabled on the desktop version of Firefox, as some popular sites including Google and Twitter are not working properly. Once the bug is fixed, the API will be enabled again.
The mobile versions including Firefox for Android and Firefox OS are not affected by this change. Also, the API has been enabled on the Metro-style version of Firefox for Windows 8.
Upvotes: 17