swiper icon indicating copy to clipboard operation
swiper copied to clipboard

`touchStartPreventDefault: false` breaks standard behavior

Open scottgonzalez opened this issue 1 year ago • 1 comments
trafficstars

Check that this is really a bug

  • [X] I confirm

Reproduction link

https://jsbin.com/mobisanici/edit?html,css,js,output

Bug description

When using touchStartPreventDefault: false and swiping on an image, the interaction either doesn't work or stops working randomly.

Moving the image down with z-index: -1 fixes the issue.

Expected Behavior

Swiping on an image works.

Actual Behavior

Native drag often occurs.

Swiper version

11.0.6

Platform/Target and Browser Versions

macOS Brave 1.6.153 (Chromium 121.0.6167.85)

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • [X] Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • [ ] I'm willing to open a PR

scottgonzalez avatar Feb 28 '24 16:02 scottgonzalez

This segment of CSS might solve your problem.

.swiper-slide {
  user-select: none;
}
.swiper-slide img {
  pointer-events: none;
}

9romise avatar Mar 31 '24 07:03 9romise