(At least!) Pan Recognizer broken in Chrome 55 and Mobile Safari
See original GitHub issueI 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:
- Created 7 years ago
- Comments:5
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.
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?