Swiper: Swiper stopped working on chrome 70

Created on 28 Oct 2018  路  16Comments  路  Source: nolimits4web/swiper

This is a (multiple allowed):

  • [x] bug
  • [ ] enhancement
  • [ ] feature-discussion (RFC)

What you did

Trying to swipe in desktop PC with touch screen

Expected Behavior

Swiper should work

Actual Behavior

Swiper not working anymore when swiping in desktops

"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...

stale

Most helpful comment

This change in Chrome broke our production software, in the exact same way as @Jing-King's video, so we had to do a quick upstream fix. The problem was only in the feature detection, so we went for changing

    touch: (win.Modernizr && win.Modernizr.touch === true) || (function checkTouch() {
      return !!(('ontouchstart' in win) || (win.DocumentTouch && doc instanceof win.DocumentTouch));
    }()),

into

    touch: true,

Of course the better solution is for a new way of detecting touch support, but all of our target devices do so this works for us. YMMV.

All 16 comments

We use this on windows desktop with a touchscreen and render the app with chrome. So chrome 70 change touch event on desktops. https://www.chromestatus.com/feature/4764225348042752
Work Around was to enable it on chrome://flags/

The problem is that i cant ask all my users to change their chrome settings...

I know what you mean, it was a workaround that works for me. but the odd part is that hammerjs is still working. http://hammerjs.github.io/

But what is the issue? Swiper already uses Pointer Events where supported

This change in Chrome broke our production software, in the exact same way as @Jing-King's video, so we had to do a quick upstream fix. The problem was only in the feature detection, so we went for changing

    touch: (win.Modernizr && win.Modernizr.touch === true) || (function checkTouch() {
      return !!(('ontouchstart' in win) || (win.DocumentTouch && doc instanceof win.DocumentTouch));
    }()),

into

    touch: true,

Of course the better solution is for a new way of detecting touch support, but all of our target devices do so this works for us. YMMV.

Is there any plan to fix this bug ?

How can i see/test the issue on a windows or windows VM without touch screen laptop/device?

Hi! Sorry for my english.
You can test this issue when run chrome with flags:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --incognito --noerrdialogs --disable-infobars --disable-suggestions-service --disable-save-password-bubble --start-maximized --disable-gpu --disable-pinch --kiosk
and open ChromeDevTools with touch device emulation.

I ran into the same issue. This has fixed it for me:

touch: (win.Modernizr && win.Modernizr.touch === true) || (function checkTouch() { return !!(('ontouchstart' in win) || (win.DocumentTouch && doc instanceof win.DocumentTouch) || navigator.maxTouchPoints > 0); }()),

Thanks HansTenBrinke ,I will try it out.
Working with chrome flags will help me personally but wont work for all my users out there...
Btw , i do not understand why a patch release is yet published...
I thought this component is highly used ..
And if this is the case how such a high bug that is relevant to millions of touch enabled pcs is not fixed and releases almost immediately ?
Can someone explain ?
Am i missing something ?

This issue should be fixed with the pull request: https://github.com/nolimits4web/swiper/pull/2913

thx...

@sagikarni
when on touch screen!
then event

new Swiper(el, {
                    loop: true,
                    on: {
                        click: function (event) {
                            if (
                                !event.target.classList.contains('swiper-pagination-bullet') &&
                                !event.target.classList.contains('swiper-button-next') &&
                                !event.target.classList.contains('swiper-button-prev')
                            ) {

                                // 鏂囨。鍦板潃
                                // https://github.com/surmon-china/vue-awesome-swiper/issues/226#issuecomment-443201823
                            }
                        }
                    }
                })

the event 'onclick' not work!
no other solution!
please fix it!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed due to inactivity. If this issue is still actual, please, create the new one.

Was this page helpful?
0 / 5 - 0 ratings