drag-drop: Provide option to enable/disable dragging of elements
See original GitHub issueBug, 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
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:5
Top Results From Across the Web
Disable Drag and Drop on HTML elements? - Stack Overflow
You can disable dragging simply by using draggable="false" attribute. https://developer.mozilla ...
Read more >JavaScript - Disable the drag and drop on html element
In this tutorial, we are going to learn about how to disable drag and drop on an html element using JavaScript.
Read more >How to Disable Dragging an Image from an HTML Page?
One way to disable dragging an image from an HTML page is to set the ondragstart property of an image element to a...
Read more >How to disable dragging an image from an HTML page using ...
Method 1: This method sets the draggable attribute to false using jQuery. Syntax: $('#myImage').attr('draggable', false);. Example:.
Read more >Using the HTML5 Drag and Drop API - web.dev
To make an object draggable set draggable=true on that element. Just about anything can be drag-enabled: images, files, links, files, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@crisbeto Hi, when will the pr merged?
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.