mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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
This commit is contained in:
committed by
Jeremy Elbourn
parent
0389d12309
commit
722dfb3633
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user