Skip to content

drag-drop: Provide option to enable/disable dragging of elements #13651

@philmtd

Description

@philmtd

Bug, feature request, or proposal:

feature request

What is the expected behavior?

I would like to be able to make drag-drop toggleable. e.g.
<div [cdkDrag]="shouldDragBeEnabled()"></div>
or
<div cdkDrag [cdkDragEnabled]="shouldDragBeEnabled()"></div>

Maybe even for whole cdkDropList elements, affecting all draggable child elements.

What is the current behavior?

Elements with cdkDrag are always draggable.

What is the use-case or motivation for changing an existing behavior?

We're making an editor for documents and we have draggable components inside this editor. Users can open documents in a read only mode (e.g. when someone else is working on a document) and in this mode the normally draggable elements should not be draggable.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

7.0.0-rc.2

Metadata

Metadata

Assignees

Labels

featureThis issue represents a new feature or feature request rather than a bug or bug fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions