-moz-touch-enabled media query fails at targeting mobile devices with touch screens

RESOLVED WORKSFORME

Status

()

Core
Widget: Android
RESOLVED WORKSFORME
7 years ago
a year ago

People

(Reporter: Louis-Rémi BABE, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:2.0b12) Gecko/20100101 Firefox/4.0b12
Build Identifier: 

-moz-touch-enabled is set to 0 instead of 1 on all mobile devices but Nokia NX00, even though they do have a touch screen.

Vivien pointed out that the following code is setting it to 0:
http://mxr.mozilla.org/mozilla-central/source/widget/src/android/nsLookAndFeel.cpp#372

and that the following code is setting it to 1 for Nokia NX00:
http://mxr.mozilla.org/mozilla-central/source/widget/src/gtk2/nsLookAndFeel.cpp#522

Reproducible: Always

Steps to Reproduce:
1. Grab a mobile device with Firefox mobile installed
2. Visit http://jsfiddle.net/xH3WW/
Actual Results:  
The square is red

Expected Results:  
The square should be green
That's an android widget bug, no?
Component: Style System (CSS) → Widget: Android
QA Contact: style-system → android
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 2

7 years ago
Wow, that's really ironic.
First Mozilla is the only one who offers media features and then it fails where you need it the most ...!
Furthermore the JS detection for touch events also fails => see http://haz.io
http://haz.io/ works for me, using current trunk Fennec build on the LG Optimus Black. I guess you were using Firefox desktop? In any case, it's not relevant to this bug.

Comment 4

7 years ago
@Martijn:
I use the version (Firefox 6.0 for Android) you get from the Market - so probably the version the vast majority of users will use ...
And you are certainly right that this (bug!?) has nothing to do with the one mentioned here but both together makes it impossible to optimize a web page for touch devices as there is no way (neither via CSS nor per JS) to detect them.
But without any doubt I'd prefer the CSS way ...! ;-)
Yes, but trunk builds are currently what Firefox 9 for Android eventually will be.
This works now, square in the JSFiddle link is green on Nightly 52 (and probably has been for a long time now).
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.