-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Swiper Element breaks touch events #6450
Comments
Why was it closed? It is clearly a bug that prevents swiper from being used together with other libraries that listens to touch events (such as MUI). |
same issue here, When i click on a MUI button that is embebed inside an slide, y makes a slide navigation. |
Yes, I need to touch events on Android 5. x/6. x。Touch Events is not supported。 |
I have the same issue. swiper-slide > * {
pointer-events: none;
} Update:To address the issue while still allowing clickable content, you can add an event listener for swiperEl.addEventListener("touchmove", (e: Event) => e.preventDefault(), { passive: false }); This approach ensures that Swiper's touch events work as expected, without affecting the functionality of clickable elements within the slides. |
Check that this is really a bug
Reproduction link
https://codepen.io/Tattoo4861/pen/eYLvwjO
Bug description
When using Swiper Element all touch events on the page are broken. Swiper takes over touch and pointer events and re-emits a invalid touchStart event that is missing many expected attributes, such as TouchEvent.touches (see https://developer.mozilla.org/en-US/docs/Web/API/Element/touchstart_event).
In the reproduction codepen we listen to touchStart which should have a touches attribute. When loading swiper the event is missing touches (among other things). If one removes the swiper script-tag the event works as expected again.
The code that is responsible for this is:
swiper/src/core/events/onTouchStart.js
Line 141 in 2533493
swiper/src/core/events/index.js
Line 22 in 2533493
Swiper should
Expected Behavior
No response
Actual Behavior
No response
Swiper version
9
Platform/Target and Browser Versions
Win10+Chrome
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: