react-compare-slider icon indicating copy to clipboard operation
react-compare-slider copied to clipboard

Scroll issue on mobile devices after "touch-action: none" styling

Open ins2718 opened this issue 1 year ago • 4 comments

Hello everyone, I wanted to bring to your attention an issue that arose in one of the commits early in 2023 (Commit Link).

In this commit, the widget received the style property "touch-action: none", resulting in the disruption of scrolling on relevant devices. This has become a critical issue, especially on mobile phones, where the widget might occupy a significant portion of the screen.

ins2718 avatar Feb 22 '24 16:02 ins2718

You can get around this by adding style={{ touchAction: "pan-y" }} to the component

LefanTan avatar Feb 23 '24 06:02 LefanTan

Thanks @ins2718 & @LefanTan,

I did add touch-action: none for a reason though I can't remember why now, might have been a Firefox issue. I'll take a look at a fix.

nerdyman avatar Feb 23 '24 21:02 nerdyman

You can get around this by adding style={{ touchAction: "pan-y" }} to the component

Yes, I fixed it by adding the class !touch-pen-y (tailwind). However, this issue was discovered accidentally and is not present on the demo pages. Therefore, I assume it's more likely a bug and should be reported.

ins2718 avatar Feb 24 '24 23:02 ins2718

touch-action: none was added to avoid the slider 'disconnecting' when you drag back and forth on touch devices. E.g. if you drag back and forth on Safari iOS without the style applied the slider will stop sliding if your finger or thumb isn't completely on the screen. I'll see if there's a better way to keep it sliding while dragging without stopping general scrolling - the style might just need to be applied while the slider is in the dragging state.

nerdyman avatar Feb 28 '24 12:02 nerdyman