New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

touch class placed on all browers on windows 8 on a regualr pc with no touch support #880

Closed
woutergovaert opened this Issue Mar 26, 2013 · 36 comments

Comments

Projects
None yet
10 participants
@woutergovaert

woutergovaert commented Mar 26, 2013

No description provided.

@stucox

This comment has been minimized.

Show comment
Hide comment
@stucox

stucox Mar 26, 2013

Member

Could you create a jsFiddle which reproduces this?

Note that Modernizr.touch tests if the browser supports the Touch Events API; not necessarily that there's a touchscreen connected. But still, most PC browsers don't support Touch Events (or at least disable the API when there's no touchscreen) so this sounds odd...

Member

stucox commented Mar 26, 2013

Could you create a jsFiddle which reproduces this?

Note that Modernizr.touch tests if the browser supports the Touch Events API; not necessarily that there's a touchscreen connected. But still, most PC browsers don't support Touch Events (or at least disable the API when there's no touchscreen) so this sounds odd...

@woutergovaert

This comment has been minimized.

Show comment
Hide comment
@woutergovaert

woutergovaert Apr 3, 2013

Sorry for the late response (I was on holiday).
I've added some screenshots (chrome and firefox have the touch class, ie10 has not)
firefox
firefox
chrome
ie10

woutergovaert commented Apr 3, 2013

Sorry for the late response (I was on holiday).
I've added some screenshots (chrome and firefox have the touch class, ie10 has not)
firefox
firefox
chrome
ie10

@stucox

This comment has been minimized.

Show comment
Hide comment
@stucox

stucox Apr 3, 2013

Member

It's possible that Firefox and Chrome have enabled the touch APIs by default on Win 8 now... I'll ask around.

In which case, this isn't a false positive.

Member

stucox commented Apr 3, 2013

It's possible that Firefox and Chrome have enabled the touch APIs by default on Win 8 now... I'll ask around.

In which case, this isn't a false positive.

@fitli65

This comment has been minimized.

Show comment
Hide comment
@fitli65

fitli65 May 2, 2013

Hi,

Since today I have the same problem with chrome 26 and firefox 20!
Safari5.1 works well as IE10 does too...
All on a Windows 8 PC

Is there an other way to detect touch screens with modernizr?

fitli65 commented May 2, 2013

Hi,

Since today I have the same problem with chrome 26 and firefox 20!
Safari5.1 works well as IE10 does too...
All on a Windows 8 PC

Is there an other way to detect touch screens with modernizr?

@tvpmb

This comment has been minimized.

Show comment
Hide comment
@tvpmb

tvpmb May 3, 2013

I can also confirm this behavior as well. Using Windows 8, inside a VMWare virtual machine, on MBP.

Seems like the touch API detection isn't enough for what people need to use it for, or there needs to be a better combination of detection for devices that aren't Smartphones/Mobile, but are touch enabled (tablets, ultrabooks, Win8 devices).

tvpmb commented May 3, 2013

I can also confirm this behavior as well. Using Windows 8, inside a VMWare virtual machine, on MBP.

Seems like the touch API detection isn't enough for what people need to use it for, or there needs to be a better combination of detection for devices that aren't Smartphones/Mobile, but are touch enabled (tablets, ultrabooks, Win8 devices).

@stucox

This comment has been minimized.

Show comment
Hide comment
@stucox

stucox May 3, 2013

Member

@fitli65 Modernizr.touch doesn't detect touchscreens! – just Touch Events API.

But still, I've confirmed with the Chrome guys that they still disable the API when there's no touchscreen on Win 8, so I'm surprised this is true with no touchscreen connected.

Can you let me know what you see here? http://codepen.io/anon/pen/JAsdy

(for some reason the 'pen' and 'full' views of that show different results on my Macbook Air?!)

Member

stucox commented May 3, 2013

@fitli65 Modernizr.touch doesn't detect touchscreens! – just Touch Events API.

But still, I've confirmed with the Chrome guys that they still disable the API when there's no touchscreen on Win 8, so I'm surprised this is true with no touchscreen connected.

Can you let me know what you see here? http://codepen.io/anon/pen/JAsdy

(for some reason the 'pen' and 'full' views of that show different results on my Macbook Air?!)

@tvpmb

This comment has been minimized.

Show comment
Hide comment
@tvpmb

tvpmb May 3, 2013

Tested on MBP, Win8 VMWare, Chrome stable:

'ontouchstart' in window? true

document instanceof DocumentTouch ? false

MQ? false

tvpmb commented May 3, 2013

Tested on MBP, Win8 VMWare, Chrome stable:

'ontouchstart' in window? true

document instanceof DocumentTouch ? false

MQ? false
@tvpmb

This comment has been minimized.

Show comment
Hide comment
@tvpmb

tvpmb May 3, 2013

@stucox FWIW - Just tested the codepen link on an iPad, identical results to the Win8 virtual machine/Chrome stable.

tvpmb commented May 3, 2013

@stucox FWIW - Just tested the codepen link on an iPad, identical results to the Win8 virtual machine/Chrome stable.

@tvpmb

This comment has been minimized.

Show comment
Hide comment
@tvpmb

tvpmb May 3, 2013

iOS (iphone/ipad) console:

typeof window.Touch
"object"

Windows 8 VM, Chrome Stable console:

typeof window.Touch
"function"

OSX, Chrome Stable, Safari latest, console:

typeof window.Touch
"undefined"

From these results, it seems like you could infer that the "object" was created by the OS, because it is/has a touch screen. When it does not need to be created, like on the virtual machine, it appears the browser, just leaves the "function" un-executed... I could be wrong though, just the observations telling me what to do.

tvpmb commented May 3, 2013

iOS (iphone/ipad) console:

typeof window.Touch
"object"

Windows 8 VM, Chrome Stable console:

typeof window.Touch
"function"

OSX, Chrome Stable, Safari latest, console:

typeof window.Touch
"undefined"

From these results, it seems like you could infer that the "object" was created by the OS, because it is/has a touch screen. When it does not need to be created, like on the virtual machine, it appears the browser, just leaves the "function" un-executed... I could be wrong though, just the observations telling me what to do.

@tvpmb

This comment has been minimized.

Show comment
Hide comment
@tvpmb

tvpmb commented May 3, 2013

PR Here: #920

@tvpmb

This comment has been minimized.

Show comment
Hide comment
@tvpmb

tvpmb May 3, 2013

I continued to look at alternative ways to properly detect this. I tried window.matchMedia('(pointer:coarse)'); as well as window.matchMedia('(hover)');. Both of these also failed the tests on the Win8 Surface Pro.

tvpmb commented May 3, 2013

I continued to look at alternative ways to properly detect this. I tried window.matchMedia('(pointer:coarse)'); as well as window.matchMedia('(hover)');. Both of these also failed the tests on the Win8 Surface Pro.

@stucox

This comment has been minimized.

Show comment
Hide comment
@stucox

stucox May 4, 2013

Member

@woutergovaert – the results you saw... were they in a VM by any chance?

Chrome and FF on Win 8 on BrowserStack report false for Modernizr.touch, and false for all 3 line in the Codepen above... so I don't believe these browsers naturally expose the ontouchstart API on Win 8. I wonder if VMWare is telling Win 8 it has a touchscreen regardless...

Member

stucox commented May 4, 2013

@woutergovaert – the results you saw... were they in a VM by any chance?

Chrome and FF on Win 8 on BrowserStack report false for Modernizr.touch, and false for all 3 line in the Codepen above... so I don't believe these browsers naturally expose the ontouchstart API on Win 8. I wonder if VMWare is telling Win 8 it has a touchscreen regardless...

@woutergovaert

This comment has been minimized.

Show comment
Hide comment
@woutergovaert

woutergovaert May 4, 2013

The results I got where on a vm indeed. It seems strange that the browser would react differently but not impossible.

Verzonden vanaf Samsung Mobile

-------- Oorspronkelijk bericht --------
Van: Stu Cox notifications@github.com
Datum: 04-05-2013 15:25 (GMT+01:00)
Aan: Modernizr/Modernizr Modernizr@noreply.github.com
Cc: woutergovaert wouter_govaert@hotmail.com
Onderwerp: Re: [Modernizr] touch class placed on all browers on windows 8 on a regualr pc with no touch support (#880)

@woutergovaert – the results you saw... were they in a VM by any chance?

Chrome and FF on Win 8 on BrowserStack report false for Modernizr.touch, and false for all 3 line in the Codepen above... so I don't believe these browsers naturally expose the ontouchstart API on Win 8. I wonder if VMWare is telling Win 8 it has a touchscreen regardless...


Reply to this email directly or view it on GitHub.

woutergovaert commented May 4, 2013

The results I got where on a vm indeed. It seems strange that the browser would react differently but not impossible.

Verzonden vanaf Samsung Mobile

-------- Oorspronkelijk bericht --------
Van: Stu Cox notifications@github.com
Datum: 04-05-2013 15:25 (GMT+01:00)
Aan: Modernizr/Modernizr Modernizr@noreply.github.com
Cc: woutergovaert wouter_govaert@hotmail.com
Onderwerp: Re: [Modernizr] touch class placed on all browers on windows 8 on a regualr pc with no touch support (#880)

@woutergovaert – the results you saw... were they in a VM by any chance?

Chrome and FF on Win 8 on BrowserStack report false for Modernizr.touch, and false for all 3 line in the Codepen above... so I don't believe these browsers naturally expose the ontouchstart API on Win 8. I wonder if VMWare is telling Win 8 it has a touchscreen regardless...


Reply to this email directly or view it on GitHub.

@tvpmb

This comment has been minimized.

Show comment
Hide comment
@tvpmb

tvpmb May 4, 2013

Seems almost like the OS is what is doing it... I did also confirm however,
it is not just a virtual machine. The problem presents also on Win8 Laptops
(Toshiba 17" without touchscreen).

On Sat, May 4, 2013 at 8:40 AM, woutergovaert notifications@github.comwrote:

The results I got where on a vm indeed. It seems strange that the browser
would react differently but not impossible.

Verzonden vanaf Samsung Mobile

-------- Oorspronkelijk bericht --------
Van: Stu Cox notifications@github.com
Datum: 04-05-2013 15:25 (GMT+01:00)
Aan: Modernizr/Modernizr Modernizr@noreply.github.com
Cc: woutergovaert wouter_govaert@hotmail.com
Onderwerp: Re: [Modernizr] touch class placed on all browers on windows 8
on a regualr pc with no touch support (#880)

@woutergovaert – the results you saw... were they in a VM by any chance?

Chrome and FF on Win 8 on BrowserStack report false for Modernizr.touch,
and false for all 3 line in the Codepen above... so I don't believe these
browsers naturally expose the ontouchstart API on Win 8. I wonder if VMWare
is telling Win 8 it has a touchscreen regardless...


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com/Modernizr/Modernizr/issues/880#issuecomment-17436100
.

tvpmb commented May 4, 2013

Seems almost like the OS is what is doing it... I did also confirm however,
it is not just a virtual machine. The problem presents also on Win8 Laptops
(Toshiba 17" without touchscreen).

On Sat, May 4, 2013 at 8:40 AM, woutergovaert notifications@github.comwrote:

The results I got where on a vm indeed. It seems strange that the browser
would react differently but not impossible.

Verzonden vanaf Samsung Mobile

-------- Oorspronkelijk bericht --------
Van: Stu Cox notifications@github.com
Datum: 04-05-2013 15:25 (GMT+01:00)
Aan: Modernizr/Modernizr Modernizr@noreply.github.com
Cc: woutergovaert wouter_govaert@hotmail.com
Onderwerp: Re: [Modernizr] touch class placed on all browers on windows 8
on a regualr pc with no touch support (#880)

@woutergovaert – the results you saw... were they in a VM by any chance?

Chrome and FF on Win 8 on BrowserStack report false for Modernizr.touch,
and false for all 3 line in the Codepen above... so I don't believe these
browsers naturally expose the ontouchstart API on Win 8. I wonder if VMWare
is telling Win 8 it has a touchscreen regardless...


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com/Modernizr/Modernizr/issues/880#issuecomment-17436100
.

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin May 5, 2013

Contributor

Well, something strange is going on. I have a Windows 8 notebook with touch, and in Chrome 26 ("Emulate touch events" disabled) I can attach a handler to window.ontouchstart. A mouse click won't trigger the handler but a tap on the screen will. So the current Modernizr detect is working fine, there really is touch event support. The only teeny tiny issue seems to be that Chrome isn't able to detect when there is no touch hardware, or the VM is lying to it.

Contributor

dmethvin commented May 5, 2013

Well, something strange is going on. I have a Windows 8 notebook with touch, and in Chrome 26 ("Emulate touch events" disabled) I can attach a handler to window.ontouchstart. A mouse click won't trigger the handler but a tap on the screen will. So the current Modernizr detect is working fine, there really is touch event support. The only teeny tiny issue seems to be that Chrome isn't able to detect when there is no touch hardware, or the VM is lying to it.

@RByers

This comment has been minimized.

Show comment
Hide comment
@RByers

RByers May 6, 2013

Contributor

The way this is supposed to be working in Chrome is as follows:
Touch APIs are present (eg. "'ontouchstart' in window" is true) if and only if:

  1. --touch-events=enable flag is set (see about:flags)
  2. --touch-events=auto (the default) and the OS reports there is a touchscreen available on chrome startup

On Windows we use the GetSystemMetrics(SM_DIGITIZER) API and see if it returns NID_READY | NID_INTEGRATED_TOUCH (source here: https://code.google.com/p/chromium/codesearch#chromium/src/ui/base/touch/touch_device_win.cc&q=IsTouchDevicePresent&sq=package:chromium&type=cs&l=12). It sounds to me like Windows 8 is returning this as true even when there's no touchscreen? I hear having the Visual Studio simulator installed can cause Windows to lie and behave as if there is a touchscreen when there isn't (http://stackoverflow.com/questions/13004911/how-to-specifically-detect-a-touch-screen-display-on-windows-8), any chance that's what's going on?

Contributor

RByers commented May 6, 2013

The way this is supposed to be working in Chrome is as follows:
Touch APIs are present (eg. "'ontouchstart' in window" is true) if and only if:

  1. --touch-events=enable flag is set (see about:flags)
  2. --touch-events=auto (the default) and the OS reports there is a touchscreen available on chrome startup

On Windows we use the GetSystemMetrics(SM_DIGITIZER) API and see if it returns NID_READY | NID_INTEGRATED_TOUCH (source here: https://code.google.com/p/chromium/codesearch#chromium/src/ui/base/touch/touch_device_win.cc&q=IsTouchDevicePresent&sq=package:chromium&type=cs&l=12). It sounds to me like Windows 8 is returning this as true even when there's no touchscreen? I hear having the Visual Studio simulator installed can cause Windows to lie and behave as if there is a touchscreen when there isn't (http://stackoverflow.com/questions/13004911/how-to-specifically-detect-a-touch-screen-display-on-windows-8), any chance that's what's going on?

@fitli65

This comment has been minimized.

Show comment
Hide comment
@fitli65

fitli65 May 7, 2013

@stucox: Sorry for my late reply!
My computer says: (with 27" Samsung SyncMater P2770HD Monitor)


'ontouchstart' in window? true
document instanceof DocumentTouch? false
MQ? false


@RByers: In my Programmslist I see: Visual Studio 2008 x64 Redistributables
Is this the simulator?

fitli65 commented May 7, 2013

@stucox: Sorry for my late reply!
My computer says: (with 27" Samsung SyncMater P2770HD Monitor)


'ontouchstart' in window? true
document instanceof DocumentTouch? false
MQ? false


@RByers: In my Programmslist I see: Visual Studio 2008 x64 Redistributables
Is this the simulator?

@stucox

This comment has been minimized.

Show comment
Hide comment
@stucox

stucox May 7, 2013

Member

Thanks for the info all.

@tvpmb – could you give us some more details about a) the VM setup you're using (including settings/services in use) and b) the Toshiba laptop you also saw a problem on? (again, services in use)

Apparently the SMART Board service and some other virtual touch drivers can also cause the OS to report that a touch device is connected.


It looks likely that this will be moved to a Chromium ticket, or some tickets aimed at various vendors. Modernizr's doing its job here: detecting the Touch Events APIs.

Ultimately, this is yet another reason why Modernizr.touch / 'ontouchstart' in window shouldn't be used to detect touch devices... there are too many variables at play to reliably assume presence of the APIs and the presence of a touch input will always correlate.

Member

stucox commented May 7, 2013

Thanks for the info all.

@tvpmb – could you give us some more details about a) the VM setup you're using (including settings/services in use) and b) the Toshiba laptop you also saw a problem on? (again, services in use)

Apparently the SMART Board service and some other virtual touch drivers can also cause the OS to report that a touch device is connected.


It looks likely that this will be moved to a Chromium ticket, or some tickets aimed at various vendors. Modernizr's doing its job here: detecting the Touch Events APIs.

Ultimately, this is yet another reason why Modernizr.touch / 'ontouchstart' in window shouldn't be used to detect touch devices... there are too many variables at play to reliably assume presence of the APIs and the presence of a touch input will always correlate.

@tagawa

This comment has been minimized.

Show comment
Hide comment
@tagawa

tagawa May 7, 2013

If you need further reports... a clean instance of Win 8 (not touchscreen, not a VM) with Firefox 20 returns true for all three lines in the CodePen link ( http://codepen.io/anon/pen/JAsdy ). IE 10 returns false for all three of them.

tagawa commented May 7, 2013

If you need further reports... a clean instance of Win 8 (not touchscreen, not a VM) with Firefox 20 returns true for all three lines in the CodePen link ( http://codepen.io/anon/pen/JAsdy ). IE 10 returns false for all three of them.

@pixelkritzel

This comment has been minimized.

Show comment
Hide comment
@pixelkritzel

pixelkritzel May 7, 2013

I, also don't have a real Win( machine. Who does?

But in Win8, the Image from modern.ie, and Paralells all the test return false in IE10 and FF20.

pixelkritzel commented May 7, 2013

I, also don't have a real Win( machine. Who does?

But in Win8, the Image from modern.ie, and Paralells all the test return false in IE10 and FF20.

@tvpmb

This comment has been minimized.

Show comment
Hide comment
@tvpmb

tvpmb May 7, 2013

@stucox The virtual machine is just a bone stock Win8 Developer's Preview from Microsoft. It is installed using VMWare Fusion 5.03. Nothing else is installed but Chrome stable.

The Toshiba laptop is a 17" Satellite p875-s7200. Aside from that I don't have much more information, except it was running Chrome stable. It belongs to a friend of a friend, so getting my hands on it will be harder, but they experienced this problem in our live application the other day.

IE 10 does work properly, so this one is a bit of a bummer altogether.

tvpmb commented May 7, 2013

@stucox The virtual machine is just a bone stock Win8 Developer's Preview from Microsoft. It is installed using VMWare Fusion 5.03. Nothing else is installed but Chrome stable.

The Toshiba laptop is a 17" Satellite p875-s7200. Aside from that I don't have much more information, except it was running Chrome stable. It belongs to a friend of a friend, so getting my hands on it will be harder, but they experienced this problem in our live application the other day.

IE 10 does work properly, so this one is a bit of a bummer altogether.

@stucox

This comment has been minimized.

Show comment
Hide comment
@stucox

stucox May 7, 2013

Member

Thanks.

As I say, I'm not treating this as a Modernizr bug... it looks like it's detecting the API correctly. But I'm still keen to get to the bottom of it.

What's your use case?

Member

stucox commented May 7, 2013

Thanks.

As I say, I'm not treating this as a Modernizr bug... it looks like it's detecting the API correctly. But I'm still keen to get to the bottom of it.

What's your use case?

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin May 7, 2013

Contributor

Above, @RByers said how they're detecting touch. It uses SM_DIGITIZER. If you read the [MSDN page](http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85\).aspx) it has this description:

SM_DIGITIZER: Nonzero if the current operating system is Windows 7 or Windows Server 2008 R2 and the Tablet PC Input service is started; otherwise, 0. The return value is a bitmask that specifies the type of digitizer input supported by the device.

I looked on my Windows 8 PC and there is no such service, but there is the "Touch Keyboard and Handwriting Panel Service" which sounds similar. Go to Control Panel, Administrative Tools, Services and find that service. Stop it, restart the browser, and see if that makes the problem go away. If so, set the service to Disabled so it won't restart.

Contributor

dmethvin commented May 7, 2013

Above, @RByers said how they're detecting touch. It uses SM_DIGITIZER. If you read the [MSDN page](http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85\).aspx) it has this description:

SM_DIGITIZER: Nonzero if the current operating system is Windows 7 or Windows Server 2008 R2 and the Tablet PC Input service is started; otherwise, 0. The return value is a bitmask that specifies the type of digitizer input supported by the device.

I looked on my Windows 8 PC and there is no such service, but there is the "Touch Keyboard and Handwriting Panel Service" which sounds similar. Go to Control Panel, Administrative Tools, Services and find that service. Stop it, restart the browser, and see if that makes the problem go away. If so, set the service to Disabled so it won't restart.

@tvpmb

This comment has been minimized.

Show comment
Hide comment
@tvpmb

tvpmb May 7, 2013

Just tried this on my VMWare Win8, disabled the "Touch Keyboard and
Handwriting Panel Service" , restarted. Chrome stable still fails the check.

On Tue, May 7, 2013 at 1:57 PM, Dave Methvin notifications@github.comwrote:

Abovehttps://github.com/Modernizr/Modernizr/issues/880#issuecomment-17481920,
@RByers https://github.com/RByers said how they're detecting touch. It
uses SM_DIGITIZER. If you read the MSDN pagehttp://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85.aspx)
it has this description:

SM_DIGITIZER: Nonzero if the current operating system is Windows 7 or
Windows Server 2008 R2 and the Tablet PC Input service is started;
otherwise, 0. The return value is a bitmask that specifies the type of
digitizer input supported by the device.

I looked on my Windows 8 PC and there is no such service, but there is the
"Touch Keyboard and Handwriting Panel Service" which sounds similar. Go to
Control Panel, Administrative Tools, Services and find that service. Stop
it, restart the browser, and see if that makes the problem go away. If so,
set the service to Disabled so it won't restart.


Reply to this email directly or view it on GitHubhttps://github.com/Modernizr/Modernizr/issues/880#issuecomment-17570076
.

tvpmb commented May 7, 2013

Just tried this on my VMWare Win8, disabled the "Touch Keyboard and
Handwriting Panel Service" , restarted. Chrome stable still fails the check.

On Tue, May 7, 2013 at 1:57 PM, Dave Methvin notifications@github.comwrote:

Abovehttps://github.com/Modernizr/Modernizr/issues/880#issuecomment-17481920,
@RByers https://github.com/RByers said how they're detecting touch. It
uses SM_DIGITIZER. If you read the MSDN pagehttp://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85.aspx)
it has this description:

SM_DIGITIZER: Nonzero if the current operating system is Windows 7 or
Windows Server 2008 R2 and the Tablet PC Input service is started;
otherwise, 0. The return value is a bitmask that specifies the type of
digitizer input supported by the device.

I looked on my Windows 8 PC and there is no such service, but there is the
"Touch Keyboard and Handwriting Panel Service" which sounds similar. Go to
Control Panel, Administrative Tools, Services and find that service. Stop
it, restart the browser, and see if that makes the problem go away. If so,
set the service to Disabled so it won't restart.


Reply to this email directly or view it on GitHubhttps://github.com/Modernizr/Modernizr/issues/880#issuecomment-17570076
.

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin May 8, 2013

Contributor

I have made a detection script, you can get it here: https://dl.dropboxusercontent.com/u/2024878/dtouch.exe

Run that in your Windows 8 VM and see what it says. On my touch-capable Windows 8 system I get this:

SM_DIGITIZER: 0x000000c1 (193)
SM_MAXIMUMTOUCHES: 0x0000000a (10)
SM_TABLETPC: 0x00000001 (1)

If you get anything other than zero, it means that Windows thinks the system is touch capable. The [MSDN page](http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85\).aspx) has the bitmap decoding for the SM_DIGITIZER value, that may tell a bit more about why it is reporting that. But if you DO get something other than zero then I agree with @stucox that it's not a Modernizr problem or even a Chrome problem.

Contributor

dmethvin commented May 8, 2013

I have made a detection script, you can get it here: https://dl.dropboxusercontent.com/u/2024878/dtouch.exe

Run that in your Windows 8 VM and see what it says. On my touch-capable Windows 8 system I get this:

SM_DIGITIZER: 0x000000c1 (193)
SM_MAXIMUMTOUCHES: 0x0000000a (10)
SM_TABLETPC: 0x00000001 (1)

If you get anything other than zero, it means that Windows thinks the system is touch capable. The [MSDN page](http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85\).aspx) has the bitmap decoding for the SM_DIGITIZER value, that may tell a bit more about why it is reporting that. But if you DO get something other than zero then I agree with @stucox that it's not a Modernizr problem or even a Chrome problem.

@fitli65

This comment has been minimized.

Show comment
Hide comment
@fitli65

fitli65 May 8, 2013

Hello all

I don't think this is only a WIN8 Problem...
I get thes results from the CodePen Test:

Chrome: 26
'ontouchstart' in window? true
document instanceof DocumentTouch? false
MQ? false

Firefox: 20
'ontouchstart' in window? true
document instanceof DocumentTouch? true
MQ? true

Safari: 5.1
'ontouchstart' in window? false
document instanceof DocumentTouch? false
MQ? false

IE10:
'ontouchstart' in window? false
document instanceof DocumentTouch? false
MQ? false

On my Laptop (HP HDX18 and also Win8 installed) I don't have any problems!

@dmethvin: I dont't find a service like this in german system... and your dtouch.exe doesn't work on my computer... It says MSVCR110.dll is missing an has to be installed...
Any idea what this could be?

fitli65 commented May 8, 2013

Hello all

I don't think this is only a WIN8 Problem...
I get thes results from the CodePen Test:

Chrome: 26
'ontouchstart' in window? true
document instanceof DocumentTouch? false
MQ? false

Firefox: 20
'ontouchstart' in window? true
document instanceof DocumentTouch? true
MQ? true

Safari: 5.1
'ontouchstart' in window? false
document instanceof DocumentTouch? false
MQ? false

IE10:
'ontouchstart' in window? false
document instanceof DocumentTouch? false
MQ? false

On my Laptop (HP HDX18 and also Win8 installed) I don't have any problems!

@dmethvin: I dont't find a service like this in german system... and your dtouch.exe doesn't work on my computer... It says MSVCR110.dll is missing an has to be installed...
Any idea what this could be?

@stucox

This comment has been minimized.

Show comment
Hide comment
@stucox

stucox May 8, 2013

Member

@fitli65 said:

I don't think this is only a WIN8 Problem...

The results I've seen so far in this thread suggest to me that Chrome and Firefox are probably both using the same Windows system parameter(s) to determine the presence of a touchscreen, and that there are cases when these can't be trusted.

Safari and IE10 don't support the Touch Events API, so we'd expect them to return false for all of these tests anyway.

I agree we shouldn't assume that it's solely Win 8 which could be affected by this kind of thing though... any platform could suffer from inconsistent settings and services messing with things.

Member

stucox commented May 8, 2013

@fitli65 said:

I don't think this is only a WIN8 Problem...

The results I've seen so far in this thread suggest to me that Chrome and Firefox are probably both using the same Windows system parameter(s) to determine the presence of a touchscreen, and that there are cases when these can't be trusted.

Safari and IE10 don't support the Touch Events API, so we'd expect them to return false for all of these tests anyway.

I agree we shouldn't assume that it's solely Win 8 which could be affected by this kind of thing though... any platform could suffer from inconsistent settings and services messing with things.

@fitli65

This comment has been minimized.

Show comment
Hide comment
@fitli65

fitli65 May 15, 2013

I found the problem!

On my computer I tested the Logitech Wireless Touchpad T650 a while ago. But did not use it much... So I removed it again. But I found out, that in the Logitech Unifying Software the Touchpad was already there and I had to unlock it first. After a reboot Firefox and Chrome act normal again! :o)
Looks like Safari and IE did not care about this.

Maybe this info helps others ;o)

fitli65 commented May 15, 2013

I found the problem!

On my computer I tested the Logitech Wireless Touchpad T650 a while ago. But did not use it much... So I removed it again. But I found out, that in the Logitech Unifying Software the Touchpad was already there and I had to unlock it first. After a reboot Firefox and Chrome act normal again! :o)
Looks like Safari and IE did not care about this.

Maybe this info helps others ;o)

@egirard

This comment has been minimized.

Show comment
Hide comment
@egirard

egirard May 15, 2013

Glad to hear that things are fixed, fitli65. Were you able to run the diagnostic that dmethvin posted? -https://dl.dropboxusercontent.com/u/2024878/dtouch.exe

I'd be very curious to know what the "Logitech Wireless Touchpad T650" is reporting under SM_DIGITIZER.

egirard commented May 15, 2013

Glad to hear that things are fixed, fitli65. Were you able to run the diagnostic that dmethvin posted? -https://dl.dropboxusercontent.com/u/2024878/dtouch.exe

I'd be very curious to know what the "Logitech Wireless Touchpad T650" is reporting under SM_DIGITIZER.

@fitli65

This comment has been minimized.

Show comment
Hide comment
@fitli65

fitli65 May 16, 2013

@egirard: No, I was not able to run the tool... I got the error message: " MSVCR110.dll is missing an has to be installed"

fitli65 commented May 16, 2013

@egirard: No, I was not able to run the tool... I got the error message: " MSVCR110.dll is missing an has to be installed"

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin May 16, 2013

Contributor

Try it now, I recompiled with static linking to circumvent DLL Hell. https://dl.dropboxusercontent.com/u/2024878/dtouch.exe

Contributor

dmethvin commented May 16, 2013

Try it now, I recompiled with static linking to circumvent DLL Hell. https://dl.dropboxusercontent.com/u/2024878/dtouch.exe

@fitli65

This comment has been minimized.

Show comment
Hide comment
@fitli65

fitli65 May 17, 2013

@dmethvin: Sorry! But I don't have the Touchpad anymore... Now (after unlocking it) my computer sais:

SM_DIGITIZER: 0x00000000 (0)
SM_MAXIMUMTOUCHES: 0x00000000 (0)
SM_TABLETPC: 0x00000000 (0)

fitli65 commented May 17, 2013

@dmethvin: Sorry! But I don't have the Touchpad anymore... Now (after unlocking it) my computer sais:

SM_DIGITIZER: 0x00000000 (0)
SM_MAXIMUMTOUCHES: 0x00000000 (0)
SM_TABLETPC: 0x00000000 (0)

@egirard

This comment has been minimized.

Show comment
Hide comment
@egirard

egirard May 17, 2013

The SM_DIGITIZER flag is used by Chrome to decide if there's a touch screen active and available. Specifically, we're looking for NID_INTEGRATED_TOUCH (0x01) and NID_READY (0x80).

Thanks for patching the utility, @dmethvin - this makes for an excellent diagnostic tool.

egirard commented May 17, 2013

The SM_DIGITIZER flag is used by Chrome to decide if there's a touch screen active and available. Specifically, we're looking for NID_INTEGRATED_TOUCH (0x01) and NID_READY (0x80).

Thanks for patching the utility, @dmethvin - this makes for an excellent diagnostic tool.

@stucox

This comment has been minimized.

Show comment
Hide comment
@stucox

stucox Jun 2, 2013

Member

To wrap up:

The consensus here seems to be that these are instances whereby the browser is fooled into thinking a touch device connected. Modernizr certainly can't do anything about this and I suspect there's not a lot the browsers can do either.

However, if anyone has sufficient information to chase this up with driver and VM vendors, that'd be great.

In any case, Modernizr.touch is doing its job here: detecting support for the Touch Events API.

See my blog post on the issue of detecting touchscreen devices here: http://www.stucox.com/blog/you-cant-detect-a-touchscreen/

Member

stucox commented Jun 2, 2013

To wrap up:

The consensus here seems to be that these are instances whereby the browser is fooled into thinking a touch device connected. Modernizr certainly can't do anything about this and I suspect there's not a lot the browsers can do either.

However, if anyone has sufficient information to chase this up with driver and VM vendors, that'd be great.

In any case, Modernizr.touch is doing its job here: detecting support for the Touch Events API.

See my blog post on the issue of detecting touchscreen devices here: http://www.stucox.com/blog/you-cant-detect-a-touchscreen/

@stucox stucox closed this Jun 2, 2013

@grantzau

This comment has been minimized.

Show comment
Hide comment
@grantzau

grantzau Jul 1, 2013

Just had the same problem when testing a project on PC Win 7, Chrome 27

I have drivers installed for a "pen" and even though it's not connected to the computer, Chrome somehow thinks, that it should support Touch Events. (Earlier versions of Chrome didn't do this.)

Thanks to the comments above I looked at the services running on the PC and after stopping the service "Tablet PC Input Service" and restarting Chrome, the "no-touch" class was added again.

So, as also mentioned in comments above, it's a problem in the way Chrome (and maybe other browsers) determines, if the OS has a touch device connected.

grantzau commented Jul 1, 2013

Just had the same problem when testing a project on PC Win 7, Chrome 27

I have drivers installed for a "pen" and even though it's not connected to the computer, Chrome somehow thinks, that it should support Touch Events. (Earlier versions of Chrome didn't do this.)

Thanks to the comments above I looked at the services running on the PC and after stopping the service "Tablet PC Input Service" and restarting Chrome, the "no-touch" class was added again.

So, as also mentioned in comments above, it's a problem in the way Chrome (and maybe other browsers) determines, if the OS has a touch device connected.

@stucox

This comment has been minimized.

Show comment
Hide comment
@stucox

stucox Jul 1, 2013

Member

Ok thanks, I'll pass this info on to the Chrome team – although, as stated earlier, Chrome gets this information from the OS, so there probably isn't a lot they can do about it.

Again, it seems to be better all round if we don't treat the presence of touch APIs as a reliable test of whether or not the device has a touchscreen.

Member

stucox commented Jul 1, 2013

Ok thanks, I'll pass this info on to the Chrome team – although, as stated earlier, Chrome gets this information from the OS, so there probably isn't a lot they can do about it.

Again, it seems to be better all round if we don't treat the presence of touch APIs as a reliable test of whether or not the device has a touchscreen.

jerbob92 referenced this issue in gitlabhq/gitlabhq Mar 10, 2014

Drew Blessing
Mobile UI improvements for dashboard/nav
Style navbar toggle button

Style navbar toggle manually instead of with button classes

Style navbar

Modify color

Turn off all tooltips for touch devices

Style main nav

Fix scrolling navbar collapse

Style tweaks

Minor tweaks

Style no ssh key message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment