Skip to content
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

hasMouse issue with Mozilla Firefox v53 #4

Closed
pnarielwala opened this issue May 2, 2017 · 7 comments
Closed

hasMouse issue with Mozilla Firefox v53 #4

pnarielwala opened this issue May 2, 2017 · 7 comments

Comments

@pnarielwala
Copy link

detect-it is showing the deviceType being touchOnly on the desktop Mozilla Firefox browser which definitely supports mouse events

@rafgraph
Copy link
Owner

rafgraph commented May 2, 2017

@pnarielwala I am unable to reproduce this issue with Firefox v53 on a MacBook Pro running macOS Sierra (it registers as mouseOnly for me). What OS and hardware are you using? Does your device have a touch screen as well as a mouse?

@pnarielwala
Copy link
Author

I'm running it on Windows 10 on a Lenovo T440s. My device does not have a touch screen which makes it weird that it shows 'touchOnly'. This is what I get from your live detection test:

deviceType: touchOnly
passiveEvents: true
hasMouse: false
hasTouch: true
maxTouchPoints: undefined
primaryHover: none
primaryPointer: coarse

Detect Hover:
hover: false
none: false
anyHover: false
anyNone: false

Detect Pointer:
fine: false
coarse: false
none: false
anyFine: false
anyCoarse: false
anyNone: false

Detect Touch Events:
hasApi: true
maxTouchPoints: undefined

Detect Passive Events:
hasSupport: true

@rafgraph
Copy link
Owner

rafgraph commented May 2, 2017

That is weird. There is a long standing issue of Firefox not implementing hover and point media queries which is why Detect Hover and Detect Pointer are all false https://bugzilla.mozilla.org/show_bug.cgi?id=1035774, but if it doesn't have a touch screen I'm surprised it's registering as though it does.

Can you run the following in your Firefox console (one at a time) and let me know the results, thanks:
window.matchMedia('(-moz-touch-enabled: 0)').matches
window.matchMedia('(-moz-touch-enabled: 1)').matches
window.TouchEvent this will either be a function or undefined
'ontouchstart' in window
'ontouchend' in document

@pnarielwala
Copy link
Author

Sure here's what I got:

window.matchMedia('(-moz-touch-enabled: 0)').matches = false
window.matchMedia('(-moz-touch-enabled: 1)').matches = true
window.TouchEvent = function ()
'ontouchstart' in window = true
'ontouchend' in document = true

@rafgraph
Copy link
Owner

rafgraph commented May 2, 2017

Thanks. Even the Firefox specific -moz-touch-enabled is saying you have a touch screen. I feel like this may be a bug in Firefox's implementation on your hardware.

Do you know if this was an issue with Firefox v52 as well?

I'll consider adding Firefox browser sniffing as a fix, probably something like if it's Firefox and it supports touch events, then call it a hybrid (because I don't think there is anyway to tell the difference between Firefox running on your laptop or on an actual hybrid, like a Surface).
You have any thoughts or suggestions?

@rafgraph
Copy link
Owner

rafgraph commented May 4, 2017

@pnarielwala I fixed this (sort of) in v3, see #5. Basically, if it registers as hasTouch with no pointer and hover support, and it's not on an Android assume it's a hybrid device with a mouse primaryInput type (if it's on Android assume it's touchOnly).

I know this means that your device with Firefox will register as a hybrid even though it should be mouseOnly, but if Firefox is going to tell me it supports touch there's not much I can do about it because it might actually be running on a hybrid device, e.g. a Surface.

Essentially since it registers as hybrid you should set both mouse and touch listeners, and the primaryInput type of mouse means you can optimize the UI for mouse input. So your site should work just fine on Firefox on your mouse only device.

@rafgraph rafgraph closed this as completed May 4, 2017
@pnarielwala
Copy link
Author

@RAFREX that will work! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants