Description
Check that this is really a bug
- I confirm
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
- not create events does not exist, such as touch-events from pointer-events
- if emitting a touchStart event make sure it is a valid TouchEvent
Expected Behavior
No response
Actual Behavior
No response
Swiper version
9
Platform/Target and Browser Versions
Win10+Chrome
Validations
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
- 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