question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(At least!) Pan Recognizer broken in Chrome 55 and Mobile Safari

See original GitHub issue

I did my own implementation of drag&drop with the latest ember-gestures lib, which depends on hammer.js and is also developed by @runspired. On desktop, all of the code works pretty well, but on Mobile/Chrome devtools emulator/Touch devices, this fails big time!

Is there any fix for this? I’m working on a rather big project which decided to go with hammer.js and ember-gestures a few months ago as it seemed like the most promising/actively developed library out there… so this is quite frustrating…

Here is a short code sample of my implementation (if it helps):

//ember-gestures/recognizers/drag.js
export default {
  include: [],
  exclude: [],
  eventName: 'pan',
  options: {
    direction: typeof Hammer === 'undefined' ? '' : Hammer.DIRECTION_ALL
  },
  recognizer: 'pan'
};
// parentComponent.js
import Ember from 'ember';
import RecognizerMixin from 'ember-gestures/mixins/recognizers';

const {
  Component,
  on,
  run: {bind},
  $
} = Ember;

export default Ember.Component.extend({
  
  recognizers: 'tap press drag',

  willDragElement: on('press', function (event) {
    const $target = $(event.target).closest('.draggable');
    const $dragClone = $target.clone();

    $dragClone.data(
      some: 'custom',
      data: 1
    )
    this.startDrag($dragClone);
  }),

  startDrag ($draggable) {
    const $dragSurface = this.$('#drag-surface');
    
    $dragSurface.append($draggable);
   
    this.on('panStart', function () {
      // .... THIS GET'S NEVER CALLED ON TOUCH DEVICES/CHROME DEVTOOLS EMULATOR!
      console.info('pan started!');
    });
    
    this.on('panMove', bind(this, 'moveDraggable'));
    
    this.on('panEnd', bind(this, function () {
       // .... THIS GET'S NEVER CALLED ON TOUCH DEVICES/CHROME DEVTOOLS EMULATOR!
      console.info('pan started!');
    }));
  },

  moveDraggable (event) {
       // .... THIS GET'S NEVER CALLED ON TOUCH DEVICES/CHROME DEVTOOLS EMULATOR!
   }
});

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
beeduulcommented, Feb 7, 2017

@herom the other thing i notice in your code is that you are using camelCase for the pan event strings. http://hammerjs.github.io/recognizer-pan/ shows they’re lowercase.

0reactions
LeJaredcommented, Feb 7, 2017

An example is not “minimal” if a heavy library like ember is included. Panning examples on http://hammerjs.github.io/ still work on iOS Safari (10.2) and desktop Chrome (56).

So maybe the bug is in ember-gestures?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Safari Technology Preview Release Notes - Apple Developer
Open tabs are blank on initial launch after upgrading to Safari Technology Preview 87 and loading all tabs from the last session. To...
Read more >
Update Google Chrome - iPhone & iPad
At the top right, tap Profile Profile . Scroll down to "Available Updates," and search for Chrome Chrome . If Chrome is listed,...
Read more >
How to prevent a browser from storing passwords
I tried the autocomplete="off" attribute in the HTML form and password fields. But it is not working in the latest browsers like Chrome...
Read more >
Google Chrome version history - Wikipedia
Google Chrome is a freeware web browser developed by Google LLC. The development process is split into different "release channels", each working on...
Read more >
touch-action - CSS: Cascading Style Sheets - MDN Web Docs
Note that scrolling "up" (pan-up) means that the user is dragging their finger downward on the ... Safari on iOS9.3 ... Chrome Android55....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found