react-carousel icon indicating copy to clipboard operation
react-carousel copied to clipboard

Disable vertical scroll (touchmove) when dragging

Open EmilEriksen opened this issue 5 years ago • 33 comments

Issuehunt badges

Currently, it's quite easy to accidentally scroll vertically when dragging (at least on iOS). This delivers a sub-par UX where you feel like you have to be really careful when you're swiping through a slideshow (it feels fragile). It should be easy to notice if you compare it do something like Zalando on iOS (or maybe any touch screen device). I was completely unable to "accidentally" scroll vertically while dragging their slider. I'm not sure how it's implemented but I'm guessing vertical touchmove is being disabled when dragging starts.


IssueHunt Summary

Backers (Total: $0.00)

Become a backer now!

Or submit a pull request to get the deposits!

Tips

EmilEriksen avatar Feb 08 '20 11:02 EmilEriksen

@EmilEriksen , You need to bind two events "touchstart" and "touchmove".

shlaing avatar Feb 10 '20 09:02 shlaing

@EmilEriksen , Disable horizontal swiping while you are doing vertical swipe. This is how I solved it. However, this library should automatically handle this and It will be cool. @piotr-s-brainhub

componentDidMount() {

    this.nv.addEventListener("touchstart", this.handleNvEnter);
    this.nv.addEventListener("touchmove", this.handleNvMove);
}

componentWillUnmount() {
    this.nv.removeEventListener("touchstart", this.handleNvEnter);
    this.nv.removeEventListener("touchmove", this.handleNvMove);
}

handleNvEnter (event) {
    this.firstClientX = event.touches[0].clientX;
    this.firstClientY = event.touches[0].clientY;
}

handleNvMove (event) {

    const minValue = 10; // threshold
    const maxValue = -10;

    this.clientX = event.touches[0].clientX - this.firstClientX;
    this.clientY = event.touches[0].clientY - this.firstClientY;

    if((this.clientX > minValue || this.clientX < maxValue) && event.cancelable){
        //console.log("Window Scroll Should Stop Here")
        event.preventDefault()
    }
}

shlaing avatar Feb 10 '20 09:02 shlaing

@piotr-s-brainhub has funded $15.00 to this issue.


issuehunt-oss[bot] avatar Mar 20 '20 16:03 issuehunt-oss[bot]

@piotr-s-brainhub has funded $1.00 to this issue.


issuehunt-oss[bot] avatar Apr 02 '20 14:04 issuehunt-oss[bot]

@piotr-s-brainhub has funded $1.00 to this issue.


issuehunt-oss[bot] avatar Apr 12 '20 14:04 issuehunt-oss[bot]

@shlaing

Thanks for your suggestion.

You're more than welcome to open a PR.

You could earn some money because it's funded on IssueHunt.

piotr-s-brainhub avatar May 13 '20 01:05 piotr-s-brainhub

Yes @piotr-s-brainhub , I can contribute that.

shlaing avatar May 13 '20 02:05 shlaing

@shlaing

That's great so we're waiting for a PR.

piotr-s-brainhub avatar May 13 '20 02:05 piotr-s-brainhub

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $15.00) See it on IssueHunt

issuehunt-oss[bot] avatar May 14 '20 00:05 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $1.00) See it on IssueHunt

issuehunt-oss[bot] avatar May 14 '20 00:05 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $1.00) See it on IssueHunt

issuehunt-oss[bot] avatar May 14 '20 00:05 issuehunt-oss[bot]

@piotr-s-brainhub has funded $18.00 to this issue.


issuehunt-oss[bot] avatar May 14 '20 13:05 issuehunt-oss[bot]

@piotr-s-brainhub has funded $10.00 to this issue.


issuehunt-oss[bot] avatar May 19 '20 00:05 issuehunt-oss[bot]

@piotr-s-brainhub has funded $8.00 to this issue.


issuehunt-oss[bot] avatar May 26 '20 13:05 issuehunt-oss[bot]

@piotr-s-brainhub has funded $5.00 to this issue.


issuehunt-oss[bot] avatar May 29 '20 11:05 issuehunt-oss[bot]

@piotr-s-brainhub has funded $10.00 to this issue.


issuehunt-oss[bot] avatar Jun 02 '20 13:06 issuehunt-oss[bot]

@piotr-s-brainhub has funded $1.00 to this issue.


issuehunt-oss[bot] avatar Jun 12 '20 14:06 issuehunt-oss[bot]

@shlaing

Are you going to work on this?

piotr-s-brainhub avatar Jun 23 '20 10:06 piotr-s-brainhub

@piotr-s-brainhub has funded $20.00 to this issue.


issuehunt-oss[bot] avatar Jun 30 '20 11:06 issuehunt-oss[bot]

@piotr-s-brainhub has funded $5.00 to this issue.


issuehunt-oss[bot] avatar Jul 07 '20 13:07 issuehunt-oss[bot]

@piotr-s-brainhub has funded $2.00 to this issue.


issuehunt-oss[bot] avatar Jul 08 '20 14:07 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $18.00) See it on IssueHunt

issuehunt-oss[bot] avatar Jul 18 '20 20:07 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $10.00) See it on IssueHunt

issuehunt-oss[bot] avatar Jul 18 '20 20:07 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $8.00) See it on IssueHunt

issuehunt-oss[bot] avatar Jul 18 '20 20:07 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $5.00) See it on IssueHunt

issuehunt-oss[bot] avatar Jul 18 '20 20:07 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $10.00) See it on IssueHunt

issuehunt-oss[bot] avatar Jul 18 '20 20:07 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $1.00) See it on IssueHunt

issuehunt-oss[bot] avatar Jul 18 '20 20:07 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $20.00) See it on IssueHunt

issuehunt-oss[bot] avatar Jul 18 '20 20:07 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $5.00) See it on IssueHunt

issuehunt-oss[bot] avatar Jul 18 '20 20:07 issuehunt-oss[bot]

@piotr-s-brainhub has cancelled funding for this issue.(Cancelled amount: $2.00) See it on IssueHunt

issuehunt-oss[bot] avatar Jul 18 '20 20:07 issuehunt-oss[bot]