@@ -30,7 +30,7 @@ import {
3030} from '@angular/core' ;
3131import { normalizePassiveListenerOptions } from '@angular/cdk/platform' ;
3232import { Observable , Subject , Subscription , Observer } from 'rxjs' ;
33- import { take } from 'rxjs/operators' ;
33+ import { startWith , take } from 'rxjs/operators' ;
3434import { DragDropRegistry } from './drag-drop-registry' ;
3535import {
3636 CdkDragDrop ,
@@ -274,7 +274,8 @@ export class CdkDrag<T = any> implements AfterViewInit, OnDestroy {
274274 const rootElement = this . _rootElement = this . _getRootElement ( ) ;
275275 rootElement . addEventListener ( 'mousedown' , this . _pointerDown , passiveEventListenerOptions ) ;
276276 rootElement . addEventListener ( 'touchstart' , this . _pointerDown , passiveEventListenerOptions ) ;
277- toggleNativeDragInteractions ( rootElement , false ) ;
277+ this . _handles . changes . pipe ( startWith ( null ) ) . subscribe ( ( ) =>
278+ toggleNativeDragInteractions ( rootElement , this . getChildHandles ( ) . length > 0 ) ) ;
278279 } ) ;
279280 }
280281
@@ -309,10 +310,14 @@ export class CdkDrag<T = any> implements AfterViewInit, OnDestroy {
309310 return this . _dragDropRegistry . isDragging ( this ) ;
310311 }
311312
313+ /** Gets only handles that are not inside descendant `CdkDrag` instances. */
314+ private getChildHandles ( ) {
315+ return this . _handles . filter ( handle => handle . _parentDrag === this ) ;
316+ }
317+
312318 /** Handler for the `mousedown`/`touchstart` events. */
313319 _pointerDown = ( event : MouseEvent | TouchEvent ) => {
314- // Skip handles inside descendant `CdkDrag` instances.
315- const handles = this . _handles . filter ( handle => handle . _parentDrag === this ) ;
320+ const handles = this . getChildHandles ( ) ;
316321
317322 // Delegate the event based on whether it started from a handle or the element itself.
318323 if ( handles . length ) {
0 commit comments