From 28e6a045dbcb0c57b2afac44c5b4e784182cf3e9 Mon Sep 17 00:00:00 2001 From: waterplea Date: Tue, 13 Oct 2020 22:27:21 +0300 Subject: [PATCH] fix(observables): `pressedObservable` ignore synthetic events --- projects/cdk/observables/pressed-observable.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/cdk/observables/pressed-observable.ts b/projects/cdk/observables/pressed-observable.ts index 24b7beac939a..259b326365a3 100644 --- a/projects/cdk/observables/pressed-observable.ts +++ b/projects/cdk/observables/pressed-observable.ts @@ -1,5 +1,5 @@ import {Observable} from 'rxjs'; -import {mapTo, startWith, switchMapTo, take} from 'rxjs/operators'; +import {filter, mapTo, startWith, switchMapTo, take} from 'rxjs/operators'; import {mouseDragFinishFrom} from './mouse-drag-finish-from'; import {typedFromEvent} from './typed-from-event'; @@ -11,6 +11,7 @@ export function pressedObservable(element: Element): Observable { } return typedFromEvent(element, 'mousedown').pipe( + filter(({isTrusted}) => isTrusted), switchMapTo( mouseDragFinishFrom(ownerDocument).pipe( mapTo(false),