Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swiping through images in a gallery getting an error #321

Closed
hchoriq opened this issue Sep 10, 2018 · 8 comments · Fixed by #399
Closed

Swiping through images in a gallery getting an error #321

hchoriq opened this issue Sep 10, 2018 · 8 comments · Fixed by #399

Comments

@hchoriq
Copy link

hchoriq commented Sep 10, 2018

Sorry - maybe all these errors are just me doing something wrong. But I set up a gallery and as I'm scrolling through the images, I get this error:

image

image

That's react-swipeable, not react-image-gallery, right? I just want to make sure I'm setting this up right before I ask a question elsewhere.

@xiaolin
Copy link
Owner

xiaolin commented Sep 12, 2018

Do you get the same error on the example page http://linxtion.com/demo/react-image-gallery? If so, please list steps on how do to reproduce this.

@ekrokowski
Copy link

@xiaolin Yes, I get the same error on the example page. But i guess that needs to be fixed in react-swipeable.
The event should only be prevented if e.cancelable is true.

Reproduce:

  1. Chrome Version: 71.0.3578.98
  2. Responsive/Mobile emulation on
  3. Swipe on image to next slide
  4. The error triggers several times

@xiaolin
Copy link
Owner

xiaolin commented Feb 5, 2019

Reopening.

@hartzis
Copy link
Contributor

hartzis commented Mar 14, 2019

@xiaolin as the react-swipeable maintainer i'd like to carve out some time this week or next to see if I can get a PR to react-image-gallery to:

A note these errors are more like warnings, since Calling preventDefault() for a non-cancelable event has no effect, MDN web docs - preventDefault#Notes

@xiaolin
Copy link
Owner

xiaolin commented Mar 14, 2019

@hartzis That would be amazing!

If you're unable to get to it let me know and I'll try to allocate some time to update it.

@hartzis
Copy link
Contributor

hartzis commented Mar 17, 2019

I think I may have grossly underestimated the complexity of this package and the time required. Just spent an hour and still having a hard time fully grasping react-swipeable's integration.

I will probably be unable to commit the time required to address this issue.

Thoughts:

  • this warning is ultimately a deeper issue related to how react attaches its touchstart/touchmove event listeners to the document and not the containers themselves
  • recommend removing the dependency on react-swipeable
    • this will allow you to attach the touch event listeners directly to the gallery's container.
      • example: Fix touch event issue casesandberg/react-color#594
      • if react-image-gallery just attached the touchstart and touchmove listeners to the galleries container, then this should allow the gallery the ability to call e.preventDefault() more appropriately
    • can easily copy whatever code from react-swipeable that is needed

Update:

@xiaolin
Copy link
Owner

xiaolin commented Mar 18, 2019

Thanks for the update @hartzis, I have been wanting to remove the dependency for a bit now and this might be a good opportunity for me to do so. I'll take a look at removing the dependency or updating it whichever is best.

@HenrikeStahlhut
Copy link

HenrikeStahlhut commented Mar 1, 2024

@xiaolin Are there any updates regarding this problem? Because I've ran into the same issue now. When swiping on mobile in fullscreen, I get a ton of Unable to preventDefault inside passive event listener invocation erros at every swipe.

I haven't found a solution jet and I am also not sure if this is due to a problem with react-swipeable / react-image-library or my fault.

Any help would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants