It appears that recent updates to Chrome (on Mac, at least) have changed their implementation of window.PointerEvent
. This causes the current version of Leaflet (1.0.2) to misdiagnose the browser as a touch device and adds the leaflet-touch
class.
This line seems to be the culprit:
pointer = window.PointerEvent || msPointer
...it can be found here: https://github.com/Leaflet/Leaflet/blob/v1.0.2/src/core/Browser.js#L33
The problem is that window.PointerEvent
is a function, which will always return 'truthy'.
leaflet-touch
class being applied to the leaflet map container.I can reproduce this as well...
Duplicate of https://github.com/Leaflet/Leaflet/issues/3944. There is no way to know if the browser is running on a computer with a touchscreen or not, it's only possible to know if the browser supports touch/pointer events or not. See also http://www.stucox.com/blog/you-cant-detect-a-touchscreen/
So, what's the point of detecting touch if it's not going to accurately detect touch? Shouldn't that whole logic be removed from leaflet then?
Most helpful comment
So, what's the point of detecting touch if it's not going to accurately detect touch? Shouldn't that whole logic be removed from leaflet then?