junkboy0315/react-compare-image

Touch events are not handled correctly

Opened this issue · 0 comments

If used on a mobile device the touch events are not handled correctly if the slider is used vertically. Instead of moving the slider, the whole page gets scrolled.

The issues seems to be located in line 169 of ReactCompareImage.tsx:

// Prevent default behavior other than mobile scrolling if (!('touches' in e)) { e.preventDefault(); }

Removing the if clause and preventing the default event handling, fixes the issue.