react-scroll-wheel-handler icon indicating copy to clipboard operation
react-scroll-wheel-handler copied to clipboard

prevent scroll is not working in mobile

Open PrabhakarKotipalli opened this issue 3 years ago • 5 comments

I tried this package. I used the prevent scroll attribute. It is working fine in desktop but when i am trying in my mobile I was able to scroll. It is not supported in mobile?

PrabhakarKotipalli avatar Feb 18 '22 06:02 PrabhakarKotipalli

Hi, as you can see in this line

https://github.com/Etto91/react-scroll-wheel-handler/blob/98ac9eafafb81846b65adad33edeaedd024d943a/src/ReactScrollWheelHandler.js#L63

preventScroll prop is only used in the wheel event.

Etto91 avatar Feb 18 '22 08:02 Etto91

Is there anyway to prevent user scrolling even in mobile?

PrabhakarKotipalli avatar Feb 18 '22 08:02 PrabhakarKotipalli

if you can, could you exactly tell me what you want to do?

Etto91 avatar Feb 18 '22 10:02 Etto91

Hi @Etto91 , the package is great and really useful. I was going to open a new issue but saw that this one is really similar. I think that what the other user is saying is that it would be useful to also prevent scrolling when the user swipes. Maybe it could be a different prop preventScrollSwipe, so that one can choose if the UX is the same when scrolling with the wheel or when swiping in a touch device.

Other thing, taking into account accesibility issues, would be to also be able to prevent scroll when using the keyboard, so that the UX is also the same for those users. This could also be a separate prop.

eliezerbaschkier avatar Apr 04 '22 14:04 eliezerbaschkier

Hi @eliezerbaschkier, thanks for clearing that up. When I have some time I'll do this enhancement. if you want feel free to open a pr :)

Etto91 avatar Apr 05 '22 07:04 Etto91