glide icon indicating copy to clipboard operation
glide copied to clipboard

Glide arrow button firing twice on iPhone 11

Open mancas11 opened this issue 6 years ago • 9 comments

When tabbing next/prev button on iPhone 11 glidejs fires two events and slides two times. When tabbing and holding while first transition finishes it onlys fires ones.

I have tested the same slider on iPhone 8 and 6S and there is no issue on these devices.

mancas11 avatar Sep 24 '19 07:09 mancas11

We have the same bug on iOS 13. Has anyone found an alternative solution or a workaround?

DFelten avatar Oct 16 '19 09:10 DFelten

A temporary solution is to using a custom method for moving the slider. So just remove data-glide-el="controls" and use instead an own click method with glide.go('>') and glide.go('<').

With glide.go the bug is gone for me.

DFelten avatar Oct 17 '19 07:10 DFelten

<a> tags fire twice. <button> tags fire once. Simple fix.

ltctech avatar Feb 19 '20 22:02 ltctech

<a> tags fire twice. <button> tags fire once. Simple fix.

Not as simple a fix as @ltctech states. I'm not using either <a> or <button> tags and it's doing it on iphone 11. I have a <ul> with data-glide-el="controls" and <li>'s with data-glide-dir values.

Triggers twice on iPhone 11, once everywhere else I've tested.

I followed @DFelten's advice and removed data-glide-el="controls" from my <ul> and added my own click listener which called glide.go( $(this).data('glide-dir') ).

PaulPrecept avatar May 06 '20 09:05 PaulPrecept

Removing the data-glide-el="controls" and adding this worked for me.

const glideArrows = document.querySelectorAll('.slider__arrow')

glideArrows.forEach(function(glideArrow) {
  glideArrow.addEventListener('click', function() {
    glide.go(glideArrow.dataset.glideDir)
  })
})

FernE97 avatar Sep 24 '20 21:09 FernE97

For .ts Like stated above, remove data-glide-el="controls" and add the following before glide.mount();

const glideArrowLeft = document.querySelector('.glide__arrow--left')
const glideArrowRight = document.querySelector('.glide__arrow--right')

glideArrowLeft.addEventListener('click', function() {
   glide.go('<');
})
         
glideArrowRight.addEventListener('click', function() {
   glide.go('>');
})

iKlancar avatar Aug 30 '22 18:08 iKlancar

Many thanks for your email.

I'm now out of the office until 13th September.

Best wishes Nick

PaulPrecept avatar Sep 06 '22 20:09 PaulPrecept

I faced the same bug, which seems to be related to iOS triggering both click and touchstart event.

Commenting out the line which binds the touchstart event fixed the problem for me:

bind (elements) {
  for (let i = 0; i < elements.length; i++) {
    Binder.on('click', elements[i], this.click)
    // Binder.on('touchstart', elements[i], this.click, capture)
  }
},

xfra35 avatar Feb 06 '24 11:02 xfra35