sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Disable Drag and drop in Modern view Library - SharePoint Online

Open MunojKannan opened this issue 8 years ago • 5 comments

Hi all,

I could disable the drag and drop functionality in classic view using the css and script, and its not reflecting in the modern view. Because the class name changes in modern view and dragdrop.js file is not available.

The below mentioned script works in classic view,

ExecuteOrDelayUntilScriptLoaded(function() { g_uploadType = DragDropMode.NOTSUPPORTED; SPDragDropManager.DragDropMode = DragDropMode.NOTSUPPORTED; }, "DragDrop.js");

and the css is

#ms-dnd-dropbox{ display: none !important; } .ms-dnd-dropbox{ display: none !important; }

Please suggest a solution to disable the drag and drop in modern view document library.

Thanks

MunojKannan avatar Aug 30 '18 11:08 MunojKannan

Alternative solution in SharePoint Online: use the SPFx to implement this.

Seiyasu avatar Aug 31 '18 09:08 Seiyasu

Is there any code snippet to implement this? can you help?

I have above requirement for one of the project. And have another requirement to disable right click feature on list item/documents.

srinutamada avatar Nov 20 '19 12:11 srinutamada

Can someone help with code snippet to implement in SPFX?

rupalinirmale avatar Dec 10 '21 11:12 rupalinirmale

You'd take advantage of SPFx application customizer to inject the needed CSS/Script on the page. Here's similar injection of html elements on the page https://github.com/pnp/sp-dev-fx-extensions/tree/main/samples/js-application-intranet-searchbox

Of course in this particular case the injection would be specific to modern SharePoint by adjusting the styles on CSS or embedding needed script to block the behavior.

VesaJuvonen avatar Dec 29 '21 14:12 VesaJuvonen

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

ghost avatar Jan 06 '22 00:01 ghost