question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

2reactions
100cmcommented, Oct 24, 2018

@crisbeto Hi, when will the pr merged?

0reactions
angular-automatic-lock-bot[bot]commented, Sep 10, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found