hammer.js: Vertically scrollable content breaks panning in Chrome 55 (Android and desktop)
If the hammer’d element has vertically scrollable content, the pan event seems to break (more specifically, event.deltaX has unexpected values). This seems to be broken as of Chrome 55,a affecting both the Android version and reproducible on touch-enabled laptops or with the DevTools touch emulator. This issue could be related to / a duplicate of #1050.
Example specimen: http://codepen.io/anon/pen/oYRQgM
Repro steps:
- Pan horizontally in the ‘not vertically scrollable’ section. Observe that panning works as expected.
- Pan horizontally in the ‘vertically scrollable’ section. Observe that the content jumps around.
Screencap:

About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 14
- Comments: 19
@bbialas
Specifying the
inputClassto use worked in my case:let mc = new Hammer(el, { inputClass: Hammer.TouchInput });Seems to fix up the pen from the original issue as well.
Only works on touch devices now, so depends what support is needed …
I was in a hurry to fix so I just edited the hammer.js script locally and changed line 384 to be:
var SUPPORT_POINTER_EVENTS = falseSolved all my troubles for now, but hoping this can be addressed in the upcoming versions
I checked it and played a bit with Hammer code. Major change between Chrome 54 and 55 is turning on Pointer Events. Because of this PointerEventInput class is used instead of TouchInput class. When I changed the code to not instantiate PointerEventInput at all it starts to work properly for me on Chrome 55. I didn’t test if such change doesn’t break IE or Edge.
@larssn Thanks for this worked a charm. I did however add a check in the buildHammer function to see if the UserAgent was Android.
Based on @cmdickson 's solution, in angular 2+ you wanna do something like this:
and then in your module providers:
Hammer team, any plan to fix it?
I ended up just writing my own carousel without Hammer 😕
For anyone interested, here’s the code