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
L.Browser.touch is incorrectly being set when on desktop (Chrome) #5266
Comments
I can reproduce this as well... |
Duplicate of #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? |
As discussed in Leaflet/Leaflet#5266 , modern web browsers like Chrome/Chromium/Opera support touch events. Thus, L.Browser.touch returns true even on non-touch screens. In any case, the _getTooltipText should display the distance if showLength is set to true. Without this change, showLength is broken in many browsers for Polyline.
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 theleaflet-touch
class.This line seems to be the culprit:
...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'.How to reproduce
leaflet-touch
class being applied to the leaflet map container.The text was updated successfully, but these errors were encountered: