New issue
Advanced search Search tips

Issue 676808 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 557565
Owner: ----
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug-Regression



Sign in to add a comment

('ontouchstart' in window) is true but the device is not touch

Reported by marco.pr...@spreaker.com, Dec 23 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36

Steps to reproduce the problem:
1. Run `("ontouchstart" in window)` on Windows 10 running on a Laptop
2. It returns `true`

What is the expected behavior?
The same version of Chrome running on Mac or Firefox latest on Windows do return `false`, while Chrome on Windows return `true`.

What went wrong?
Despite this is formally correct, because Chrome on Windows do support touch event listeners, this actually breaks some web applications that relies on this check to "guess" if it's a touch device and improve the UX accordingly (some UI can benefit from a mouse).

Did this work before? Yes According to  issue #467934  it was fixed, then came back on Chrome 54

Chrome version: 55.0.2883.87  Channel: stable
OS Version: 10
Flash Version:
 

Comment 1 by bokan@chromium.org, Dec 23 2016

Cc: bokan@chromium.org
Components: -Blink Blink>Input
Mergedinto: 557565
Status: Duplicate (was: Unconfirmed)
Chrome is just reflecting what the OS is telling us.  Issue 467934  wasn't a bug, per-se, I think you're having the smae issue. There are cases where the OS reports a touchscreen when there isn't a real one (see issue 557565). I'm not seeing this on my Windows box so I'm guessing you have some configuration/driver that's causing that.

Note that we do eventually want to remove this and have `"ontouchstart" in window` always return true ( issue 392584 ).  If you're building a page, you should really be using the pointer media query to determine the presence of a touch device (https://developer.mozilla.org/en/docs/Web/CSS/@media/pointer).  Issue 669481  has more details.

If you're just finding that pages you're navigating to are breaking because of this, you can turn off touch events explicitly using chrome://flags/#touch-events. It'd also be helpful if you reported sites that are broken so we can try to reach out to get them fixed or see if we can work around the issues.
I was using the pointer media query to determine the presence of a touch
device, but starting from Chrome 55 Android on Nexus 5x matches the
"(pointer: fine)" media query, so I'm not sure how to reliably use it.

Any hint?

Comment 3 by bokan@chromium.org, Dec 23 2016

Yikes! That's a real regression, thanks for bringing that up. It appears fixed in Canary (M57) but still broken in Beta. I'll try to find the fixing patch and see if we can get that shipped sooner. 

Comment 4 by bokan@chromium.org, Dec 23 2016

Ok, this is already known ( issue 672907 ) and will be merged to beta so the issue should be resolved in M56. 
#4 M56 doesn't fix the issue.

Comment 6 by bokan@chromium.org, Mar 3 2017

If you're referring to the issue in #2 then it seems fixed for me in M56 (see http://bokand.github.io/mq.html). Hover:none seems to be broken instead (sigh), I filed  issue 654861 .

If you're referring to the original report then see my comment in #1 - it's likely not a Chrome bug.

Sign in to add a comment