flickity icon indicating copy to clipboard operation
flickity copied to clipboard

iOS 13 bugfix

Open henrybarn opened this issue 5 years ago • 12 comments

It looks like dragMove and dragEnd are both called on dragEnd in iOS 13. previousDragX and dragX become the same value because of the dragMove call. dragEndBoostSelect when called, evaluates to zero.

This primitive solution only reassigns previousDragX when dragX is changing.

Fixes: #992 #959

henrybarn avatar Dec 24 '19 15:12 henrybarn

please merge! This should have been fixed a long time ago.

HandHugs avatar Jan 09 '20 22:01 HandHugs

Hello. We have also some issues with IOS13 and swiping. Please merge. Thanks in advance

Hello. I experienced this issue for a project and testing from an iPhone X and iOS 13. I've tested and this does remedy all fixes related.

cezr avatar Jan 30 '20 01:01 cezr

Hey. If someone could merge and fix this, that would be great.

106firestarter avatar Jan 31 '20 12:01 106firestarter

Does anyone know a way that I can use this as a patch ? Has it been merged? sorry I am not sure if I'm understanding correctly about how this works...

HandHugs avatar Mar 10 '20 17:03 HandHugs

Add a 👍 reaction to this issue if you would like to see this feature added. Do not add +1 comments — They will be deleted


Thanks so much for this contribution and for digging into this problem. I'm having trouble reproducing the issue. Testing with iOS 13.3.1. Can you go to Flickity Events Demo and share a screen capture of the output?

I was not able to trigger pointerMove at the same time as pointerUp

IMG_90B24F99C13E-1


In the meantime, if anyone needs this fix immediately, you can add it as a duck punch. Add this code:

Flickity.prototype.dragMove = function( event, pointer, moveVector ) {
  if ( !this.isDraggable ) {
    return;
  }
  event.preventDefault();

  // reverse if right-to-left
  var direction = this.options.rightToLeft ? -1 : 1;
  if ( this.options.wrapAround ) {
    // wrap around move. #589
    moveVector.x = moveVector.x % this.slideableWidth;
  }
  var dragX = this.dragStartPosition + moveVector.x * direction;

  if ( !this.options.wrapAround && this.slides.length ) {
    // slow drag
    var originBound = Math.max( -this.slides[0].target, this.dragStartPosition );
    dragX = dragX > originBound ? ( dragX + originBound ) * 0.5 : dragX;
    var endBound = Math.min( -this.getLastSlide().target, this.dragStartPosition );
    dragX = dragX < endBound ? ( dragX + endBound ) * 0.5 : dragX;
  }

  if ( this.dragX !== dragX ) {
    this.previousDragX = this.dragX;
  }

  this.dragX = dragX;

  this.dragMoveTime = new Date();
  this.dispatchEvent( 'dragMove', event, [ pointer, moveVector ] );
};

desandro avatar Mar 25 '20 16:03 desandro

Thank you, excellent job on the documentation getting setup wasn't hard at all. This is a screenshot taken after I got the bug to fire, swiping from 1 to 2. I hope it's useful. I don't see a dragEnd call, maybe the event was canceled because the browser picked up slight intent to scroll?

Flickity · Events

henrybarn avatar Mar 25 '20 17:03 henrybarn

I can confirm that the issue persists in Safari in iOS 14.4.1...

whataboutpereira avatar Mar 19 '21 14:03 whataboutpereira

@desandro: NO movement on their carousel at all. iOS 15.0.1 & 14.0 scrolling is not working. could you please help on this,.

vasanthangel4 avatar Oct 17 '21 00:10 vasanthangel4

@DanArthurGallagher: i have using vanilla javascript. i have updated like this as well. but after add this code also iOS 15 scroll is not woking.

$carousel.on( 'dragStart.flickity', function( event, pointer ) {

document.ontouchmove = function (e) { e.preventDefault(); } }); $carousel.on( 'dragEnd.flickity', function( event, pointer ) { document.ontouchmove = function (e) { return true; e.preventDefault();

} });

vasanthangel4 avatar Oct 20 '21 17:10 vasanthangel4

flickity not at all working in ios 15. no solution helping for ios 15 intermittent not scrolling in mobile device issue there. please dont advertise everyone flickity will work on all the devices. we have reported this issue many times.

vasanthangel4 avatar Nov 02 '21 17:11 vasanthangel4

Any chance of getting this merged and released? Thanks!

whataboutpereira avatar Aug 30 '23 20:08 whataboutpereira