Skip to content

Commit

Permalink
fix(cdk/drag-drop): remove boundary error (#23966)
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 02908ce)
  • Loading branch information
crisbeto authored and zarend committed Nov 19, 2021
1 parent a25dda6 commit a3f99f8
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/cdk/drag-drop/directives/drag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,16 +370,7 @@ export class CdkDrag<T = any> implements AfterViewInit, OnChanges, OnDestroy {
return this.element.nativeElement.closest<HTMLElement>(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. */
Expand Down

0 comments on commit a3f99f8

Please sign in to comment.