ionic-team / ionic-v3

The repo for Ionic 3.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
128 stars 85 forks source link

Swiper (ion-slides) not responding to touch #472

Open ionitron-bot[bot] opened 5 years ago

ionitron-bot[bot] commented 5 years ago

Original issue by @sagikarni on 2018-10-28T21:49:26Z

Bug Report

Describe the Bug Swiper component no longer works with touch events on desktop (chrome 70) Steps to Reproduce Steps to reproduce the behavior: goto https://codepen.io/-kaik-/pen/ONNzWe try to swipe in desktop machine (touch screen) with chrome 70

"ontouch* members on window, document, and element are disabled by default on desktop devices" see here : https://www.chromestatus.com/feature/4764225348042752

Any workarounds ? btw , "slick" swiper (http://kenwheeler.github.io/slick/) seems to be working well...

netro83 commented 5 years ago

node_modules\ionic-angular\components\slides\swiper\swiper-events.js

Replace:

 s._supportTouch = (function () {
        return !!(('ontouchstart' in win) || win.DocumentTouch && doc instanceof win.DocumentTouch);
    })();

to

s._supportTouch = (function () {
        return !!((window.navigator.maxTouchPoints > 0) || ('ontouchstart' in window) || (window.DocumentTouch && document instanceof window.DocumentTouch));
    })();
jaredgrabill commented 2 years ago

Hey @netro83, did you create a monkey patch for this issue, or did you fork and fix it and can submit a PR? The issue is persisting thru Ionic 6.