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

Touches are classified as mouse events #547

Open
fefrei opened this issue May 5, 2014 · 7 comments
Open

Touches are classified as mouse events #547

fefrei opened this issue May 5, 2014 · 7 comments
Labels

Comments

@fefrei
Copy link

fefrei commented May 5, 2014

On Firefox 29.0, running on Windows, with hammer.js 1.1.2, events have event.gesture.pointerType === 'mouse' even though they are caused by a touchsceen.

@MichielioZ
Copy link

Does that create any problems ?

@fefrei
Copy link
Author

fefrei commented May 6, 2014

Yes - for me, it totally defeats the purpose. I'm trying to detect whether a user has a touchscreen, to display a more touch-friendly UI in that case. To do so, I'm listening to touch events on the whole window (which are fired by mouse clicks, too) and then do a if (event.gesture.pointerType === 'touch') to identify real touches.

@MichielioZ
Copy link

Did you test in other browsers if the same behaviour occurs ?
Maybe Firefox fires both events at the same time (some mobile browsers do this).
Perhaps it's possible to detect if touch events are supported outside of hammer with a seperate little script and then set hammer to use touch if available ? (just an idea, I have no (working) code here)

@fefrei
Copy link
Author

fefrei commented May 6, 2014

This works fine in Chrome, Internet Explorer and Mobile Safari. Opera appears to have the same issue.
Testing if touch events are supported is pretty useless nowadays - all modern browser support them, but they don't indicate that a touchscreen is physically present.

@MichielioZ
Copy link

If you tested which events fire in different browsers and the events are the same (ie they all fire both mouse- and touch-events) but Firefox is the only one causing problems, you're probably better off filing a bug report at Firefox I think...
Good luck with the issue, as I can no longer be of use to you ;-) (have no touch monitor to test)

@fefrei
Copy link
Author

fefrei commented May 6, 2014

I have no idea whether these browsers actually fire two events - I just checked the hammer.js-events, and these have the incorrect pointerType. I'm still suspecting this is a hammer.js-issue, since both Firefox and Opera have this issue (and they have different engines).

I might investigate this further if I have enough time soon. Thanks for your help :)

@fefrei fefrei changed the title Touches are classified as mouse events on Firefox Touches are classified as mouse events Sep 7, 2014
@fefrei
Copy link
Author

fefrei commented Sep 7, 2014

Now with Chrome 37 and hammer.js 2.0.2, this issue also manifested itself in Chrome. So for now, pointerType is broken in Chrome and Firefox - it still works in IE, though.

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

No branches or pull requests

3 participants