hammerjs / hammer.js

A javascript library for multi-touch gestures :// You can touch this
http://hammerjs.github.io
MIT License
24.13k stars 2.62k forks source link

iOS Safari & Android Chrome inconsistencies #1166

Open horacegrant opened 6 years ago

horacegrant commented 6 years ago

In my project I need swipe gestures in all directions and there are some divs that are supposed to allow normal "overflow: auto;" scrolling.

Why does it behave that way? How could i fix it?

icesoar commented 6 years ago

v2.0.8 has this issue, v2.0.7 works fine.

In commit fbe9fd775fe8cb3d43faa9428bfa56b61b16edc7,

if (NATIVE_TOUCH_ACTION) { return; }

is removed from TouchAction.preventDefaults. These code skips preventDefault() calling, scrolling is allowed.

In new implementation of v2.0.8, TOUCH_ACTION_MAP is used for controlling preventDefault(), which is generated by getTouchActionProps(). The event's preventDefault() is called in current logic when user touching a scrollable DOM, scrolling is blocked.

But I didn't go deep into the logic, so I don't know how to fix it.

I have to fall back to v2.0.7 to fix scrolling problem. I wish someone can fix this in next release. Thx!