Open ndkv opened 9 years ago
Hey @ndkv, thanks for the investigation. Since null
is a falsy value - would changing it to win.ontouchstart
help?
I don't think so as ontouchstart
is also null
on mobile browsers. Simply checking its value will break dragend on them.
Detecting touch is a messy business (see this Stackoverflow question).
Seeing that these things apparently change overnight, I think the best strategy is to include a custom build of e.g. Modernizr to check for touch capabilities. Sadly that isn't a robust solution either.
Another option is to implement both at the same time as mentioned here and here.
Thinking of using this lib, but this issue makes me hesitant. Any progress?
Dragend doesn't work on Chrome anymore.
It seems that the
isTouch = 'ontouchstart' in win
check on line 100 isn't valid anymore.ontouchstart
is present inwin
(but has a value of null) henceisTouch
always evaluates totrue
. This breaks swiping on desktop browsers as mouse events are not handled anymore.This was already the case with Firefox (see my brief investigation in issue #46) but is now also happening on Chrome. Last week everything worked fine on Chrome (desktop) as it didn't have an
ontouchstart
property inwin
and the check on line 100 returnedfalse
.Oddly enough, mobile browsers also report that
ontouchstart
isnull
so I wouldn't know how to differentiate between desktop and mobile without using a full-fledged browser detection library. Any thoughts?