hooper icon indicating copy to clipboard operation
hooper copied to clipboard

Prevent vertical scroll due left/right swipe on touchable devices

Open StanZhuravlev opened this issue 5 years ago • 9 comments

When I swipe slides left/right on mobile phone, the screen a few scroll up and down. It's non comfort and bad usability.

I have a research of this question, and saw a different solution of this issue.

  1. (bad) In tochmove/touchstart/touchend callbacks make a css style overflow-y: hidden. It's make left/right scroll clean, but when I need scroll page up/down - the slider component ignore my touch. It's bad, because if I orient phone to landscape, and hooper fill all screen - I lose possibility scroll page :( For example, see this.
  2. (good) The best usability was on vuw-awesome-swiper (based on swiper4 library). In this case, I have a fixed vertical position, when swipe left/right, but I have possiblity scroll page up/down when make on swiper verticals taps.

Can you add support of scrolling like as swiper4 library? Very please. :)

StanZhuravlev avatar Nov 20 '19 04:11 StanZhuravlev

Up. This would be a killer feature usability wise. On iPhones the unwanted verticale scroll is even worse. Maybe a workaround Is possible using the hooks provided by the component? Need to test it

sintj avatar Feb 04 '20 19:02 sintj

Any ideas how I can fix it?

cogor avatar Jul 15 '20 13:07 cogor

Any ideas how I can fix it?

the only solution i have in mind is, when touch event starts, grab the body and lock overflow-y, when it stops reactivate it

sintj avatar Jul 15 '20 13:07 sintj

@sintj Oh, thanks =)

cogor avatar Jul 15 '20 13:07 cogor

I founded simple fix, just add @touchstart.prevent="" on slider wrapper

cogor avatar Jul 15 '20 14:07 cogor

I founded simple fix, just add @touchstart.prevent="" on slider wrapper

inside "" goes nothing?

sintj avatar Jul 15 '20 14:07 sintj

I founded simple fix, just add @touchstart.prevent="" on slider wrapper

inside "" goes nothing?

Yep or you can add any function

cogor avatar Jul 15 '20 14:07 cogor

I founded simple fix, just add @touchstart.prevent="" on slider wrapper

inside "" goes nothing?

Yep or you can add any function

Nice hack but, sadly, it doesn’t allow vertical page scrolling on mobile which is not optimal

frizurd avatar May 04 '23 17:05 frizurd

Update: I applied the following CSS to the div that contains the hooper element

touch-action: pan-y;

This only allows vertical swiping on the element. But horizontal swiping still works because of the hooper code :)

Let me know if it also works for you guys

frizurd avatar May 05 '23 05:05 frizurd