From 08db0ee4bb07ec02bd06b43ddb49e7c7a6a775f7 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Mon, 15 Nov 2021 08:16:28 +0100 Subject: [PATCH] fix(cdk/drag-drop): remove boundary error When the boundaries were added to the `drag-drop` module, I assumed that users would always want the element to be contained inside the boundary, but it looks like there are some cases where that's not the case. These changes remove the error. Fixes #23767. --- src/cdk/drag-drop/directives/drag.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/cdk/drag-drop/directives/drag.ts b/src/cdk/drag-drop/directives/drag.ts index 65539796ed5e..a494509a0001 100644 --- a/src/cdk/drag-drop/directives/drag.ts +++ b/src/cdk/drag-drop/directives/drag.ts @@ -370,16 +370,7 @@ export class CdkDrag implements AfterViewInit, OnChanges, OnDestroy { return this.element.nativeElement.closest(boundary); } - const element = coerceElement(boundary); - - if ( - (typeof ngDevMode === 'undefined' || ngDevMode) && - !element.contains(this.element.nativeElement) - ) { - throw Error('Draggable element is not inside of the node passed into cdkDragBoundary.'); - } - - return element; + return coerceElement(boundary); } /** Syncs the inputs of the CdkDrag with the options of the underlying DragRef. */