Disable Drag and drop in Modern view Library - SharePoint Online
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
Alternative solution in SharePoint Online: use the SPFx to implement this.
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.
Can someone help with code snippet to implement in SPFX?
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.
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