Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cdk/drag-drop/directives/drag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export class CdkDrag<T = any> implements AfterViewInit, OnChanges, OnDestroy {
config.dragStartThreshold : 5,
pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
config.pointerDirectionChangeThreshold : 5,
propagateEvents: coerceBooleanProperty(config && config.propagateEvents),
zIndex: config?.zIndex
});
this._dragRef.data = this;
Expand Down
3 changes: 2 additions & 1 deletion src/cdk/drag-drop/drag-drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {DragDropRegistry} from './drag-drop-registry';
/** Default configuration to be used when creating a `DragRef`. */
const DEFAULT_CONFIG = {
dragStartThreshold: 5,
pointerDirectionChangeThreshold: 5
pointerDirectionChangeThreshold: 5,
propagateEvents: false
};

/**
Expand Down
11 changes: 10 additions & 1 deletion src/cdk/drag-drop/drag-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ export interface DragRefConfig {
*/
pointerDirectionChangeThreshold: number;

/**
* Whether touch/mouse begin events should propagate to
* parent elements in the DOM when CDK initiates a drag
* sequence.
*/
propagateEvents: boolean;

/** `z-index` for the absolutely-positioned elements that are created by the drag item. */
zIndex?: number;
}
Expand Down Expand Up @@ -744,7 +751,9 @@ export class DragRef<T = any> {
// Always stop propagation for the event that initializes
// the dragging sequence, in order to prevent it from potentially
// starting another sequence for a draggable parent somewhere up the DOM tree.
event.stopPropagation();
if (!this._config.propagateEvents) {
event.stopPropagation();
}

const isDragging = this.isDragging();
const isTouchSequence = isTouchEvent(event);
Expand Down