Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't drag file to the window of an electron app #12460

Closed
jaweii opened this issue Mar 28, 2018 · 15 comments
Closed

can't drag file to the window of an electron app #12460

jaweii opened this issue Mar 28, 2018 · 15 comments

Comments

@jaweii
Copy link

jaweii commented Mar 28, 2018

  • Electron version: 1.8.3
  • Operating system: windows 10

Expected behavior

I want to drag a file to the window of an electron app , But I can't do this, when I drag the file to the application window, the mouse cursor becomes disabled.

Actual behavior

the mouse cursor changes to disabled: 🛇
can't capture drag & drop event

How to reproduce

//Install vue-cli and scaffold boilerplate
npm install -g vue-cli
vue init simulatedgreg/electron-vue my-project

//Install dependencies and run your app
cd my-project
yarn # or npm install
yarn run dev # or npm run dev

2

@jukefr
Copy link

jukefr commented Aug 25, 2018

Did you ever find a solution to this problem ? I am experiencing the same thing.

@sanchezpablo
Copy link

Same behaviour here... any solution for this? Electron 2.0.4

@assmdx
Copy link

assmdx commented Sep 16, 2018

Did you ever find a solution to this problem ? I am experiencing the same thing in Electron 2.0.8

@sanchezpablo
Copy link

As far as I understand, the problem is when the application runs in Administration mode (windows), in this mode it's impossible to drag and drop files because the OS is avoiding this behavior, if the same application runs with normal user rights, the drag and drop of files works as expected. I don't know if there is some technique to change this, although.

@sofianguy sofianguy added the 2-0-x label Jan 7, 2019
@sofianguy
Copy link
Contributor

Thank you for taking the time to report this issue and helping to make Electron better.

The version of Electron you reported this on has been superseded by newer releases.

If you're still experiencing this issue in Electron v4.2.x or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.

I'm setting the blocked/need-info label for the above reasons. This issue will be closed 7 days from now if there is no response.

Thanks in advance! Your help is appreciated.

@sofianguy sofianguy added the blocked/need-info ❌ Cannot proceed without more information label Aug 9, 2019
@l1b3r
Copy link

l1b3r commented Aug 12, 2019

I can confirm having the same issue with electron 5.0.2 which wraps Angular 8.2.0 application. I have a file-input component that works as expected in a different Angular application that runs in the browser. However, if I copy-paste it into the Angular-under-electron application on Windows (no Admin privileges though), I'm also getting the 🛇 icon and can't drop anything.

<div class="drop-container"
     (dragover)="$event.preventDefault(); $event.dataTransfer.dropEffect = 'move';"
     (drop)="dropped($event)">...</div>
dropped(event) {
  event.preventDefault();
  // process the dropped files via accessing event.dataTransfer.items or event.dataTransfer.files.length
}

Is there any configuration required in the ipcMain process of electron to enable drag'n'dropping files from the OS into the application?

@sofianguy sofianguy added 5-0-x and removed blocked/need-info ❌ Cannot proceed without more information labels Aug 12, 2019
@sofianguy sofianguy added this to Unsorted Issues in 5.0.x Aug 12, 2019
@ghost
Copy link

ghost commented Sep 12, 2019

Is this issue resolved in electron 6.x.x by chance? I'm also getting the 🛇 icon and can't drop anything.
Again it does work in a browser, but not in the Angular electron application.

@bpasero
Copy link
Contributor

bpasero commented Oct 15, 2019

VSCode is also hitting this. Cross referencing: microsoft/vscode#38999

@railsjack
Copy link

same issue

@SharePointRadi
Copy link

SharePointRadi commented Oct 26, 2019

This is not a problem with Electron, this is a Windows OS concept (Mandatory Integrity Control).

If you run Electron from an administrator mode console, or any "Run as Administrator" process, then you try to drag&drop from a Windows Explorer instance (which can't run in administrator mode), then Drag & Drop, and many other capabilities, will not work.

If I run my Electron app from a normal console with no administrator UAC elevation, I can drag and drop normally.

See Windows integrity levels, process explorer can show which process cross the integrity level.

image

I have posted more info in the referenced VSCode issue.

@swampthang
Copy link

swampthang commented Jul 26, 2020

According this article, I created a .bat file with the following:

cmd /min /C "set __COMPAT_LAYER=RUNASINVOKER && start "" %1"

Saved it to my desktop and dragged the exe of my electron app onto the .bat file icon and it opened the app and allowed me to drag and drop onto the app window just fine.

What I'm wondering is this: Is there a way to build that into the packaged app? Iow, have that command execute automatically when someone opens the app without having to tell someone what to do?

@pedro-surf
Copy link

Any good news or better trick to accomplish it while developing on Win10?

@riccardospeggiorin-centropaghe

any news?
I still having the issue. the OS (w10) block my drag n drop with the block-icon!

@zcbenz
Copy link
Contributor

zcbenz commented Dec 10, 2020

As explained by #12460 (comment), this is a limitation applied by Windows itself and we are unable to solve it. So I'm closing this as won't fix.

@ArnieGA
Copy link

ArnieGA commented Jun 14, 2022

This is not a problem with Electron, this is a Windows OS concept (Mandatory Integrity Control).

If you run Electron from an administrator mode console, or any "Run as Administrator" process, then you try to drag&drop from a Windows Explorer instance (which can't run in administrator mode), then Drag & Drop, and many other capabilities, will not work.

If I run my Electron app from a normal console with no administrator UAC elevation, I can drag and drop normally.

See Windows integrity levels, process explorer can show which process cross the integrity level.

image

I have posted more info in the referenced VSCode issue.

Confirming that running VSCode without administrative privileges solved the issue on my end.
This creates a very big problem from many of us, yet for the moment is a workaround.
Thank you very very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
5.0.x
Unsorted Issues
Development

No branches or pull requests