From 722dfb363377568af4186761db4cc595660b4894 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 11 Sep 2018 19:45:03 +0200 Subject: [PATCH] fix(tooltip): not showing up on touch devices (#12940) * Currently if someone long presses a tooltip trigger on a touch device, the tooltip will not show up. This is because the `longpress` event does reset immediately and not fire if a `slide` event is being recognized. The `slide` event most likely fires most of the time because of a `threshold = 0` (for smooth sliding) Fixes #12917 --- src/lib/core/gestures/gesture-config.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/core/gestures/gesture-config.ts b/src/lib/core/gestures/gesture-config.ts index bbfacffe018..39baa616551 100644 --- a/src/lib/core/gestures/gesture-config.ts +++ b/src/lib/core/gestures/gesture-config.ts @@ -100,6 +100,13 @@ export class GestureConfig extends HammerGestureConfig { // Overwrite the default `pan` event to use the swipe event. pan.recognizeWith(swipe); + // Since the slide event threshold is set to zero, the slide recognizer can fire and + // accidentally reset the longpress recognizer. In order to make sure that the two + // recognizers can run simultaneously but don't affect each other, we allow the slide + // recognizer to recognize while a longpress is being processed. + // See: https://github.com/hammerjs/hammer.js/blob/master/src/manager.js#L123-L124 + longpress.recognizeWith(slide); + // Add customized gestures to Hammer manager mc.add([swipe, press, pan, slide, longpress]);