Modernizr considers TFF to be a touch device

Funtoosh's Avatar


02 Nov, 2015 03:46 PM

Now this is a weird one ... I've come across this for a while now but could not get my head around it: in my favorite CMS (Textpattern), the default desktop menu has been replaced by the touch menu option, a select form element. When I was digging thru the code today, I found that modernizr (v2.6.2) adds the following classes to a CMS page's HTML element:

<html class=" js touch rgba boxshadow opacity svg"
… effectively identifying it as a touch device and ultimately leading to the swap of menus. I think this has been around since 38.3, but not before.
Does that make any sense at all?


PS you can see this method of detecting touch in action here:
There is, of course, much argumentation against such ways of detection, however, the method is widely in use thanx to html5boilerplate …

  1. 1 Posted by funtoosh on 02 Nov, 2015 03:48 PM

    funtoosh's Avatar

    Ups, there was a typo in my email address …

  2. 2 Posted by funtoosh on 02 Nov, 2015 03:53 PM

    funtoosh's Avatar

    Okay, I changed dom.w3c_touch_events.enabled in about:config from 1 to 0, problem solved. Not sure whether the default was 1 or not.

  3. 3 Posted by funtoosh on 02 Nov, 2015 04:08 PM

    funtoosh's Avatar

    One more (and hopefully final) follow-up just to close the issue, it appears that in some (if not all) versions of FF the flip of the touch simulator switch in dev tools changes dom.w3c_touch_events.enabled to 1, as it should, but without resetting it when un-checking the button or restarting FF.
    Sorry for the confusion!

  4. Support Staff 4 Posted by Cameron Kaiser on 03 Nov, 2015 02:00 PM

    Cameron Kaiser's Avatar

    Yes, we didn't make any change of that sort, but good to know you discovered why. Glad it is functioning as you expect now.

  5. Cameron Kaiser closed this discussion on 03 Nov, 2015 02:00 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

24 Aug, 2019 08:37 AM
22 Aug, 2019 10:51 PM
22 Aug, 2019 10:44 PM
19 Aug, 2019 03:03 AM
14 Aug, 2019 12:17 PM