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

[Bug] Drag and Drop files onto extensions also opens the file inside the default application for that file type #218626

Closed
swordensen opened this issue Jun 26, 2024 · 7 comments · Fixed by #219148
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug webview Webview issues
Milestone

Comments

@swordensen
Copy link
Contributor

Type: Bug

  1. clone repo https://github.com/maxbublik/vscode-customeditor-drop
  2. press f5 to demo repo
  3. drag and drop any file into the extension editor while holding shift

Notes:
I am primarily creating this issue to track the bug I made with #209211

VS Code version: Code - OSS Dev 1.91.0 (Commit unknown, Date unknown)
OS version: Windows_NT x64 10.0.22631
Modes:

System Info
Item Value
CPUs AMD Ryzen 7 5800X 8-Core Processor (16 x 3800)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.93GB (20.85GB free)
Process Argv . --disable-extension=vscode.vscode-api-tests
Screen Reader no
VM 50%
Extensions disabled
Recording.2024-06-26.144912.mp4
@VSCodeTriageBot
Copy link
Collaborator

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.90.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@swordensen
Copy link
Contributor Author

My plan is to bubble up the "drop" event like I did with the "drag" event and prevent default in the webviewDragAndDrop setting.

However, I think it should be noted that extension developers can prevent default on their own and prevent the files from opening.

I'm not 100% sure if VSCode should assume that responsibility or not but I'll make the PR anyways once I verify that my idea works. Probably this weekend when I have time!

@swordensen
Copy link
Contributor Author

I didn't need to bubble up the event since VSCode doesn't need to do anything with the drop event. I simply prevented default within the extension iframe html.

@mjbvz mjbvz modified the milestones: July 2024, June 2024 Jul 2, 2024
@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug webview Webview issues labels Jul 2, 2024
@mjbvz mjbvz added the candidate Issue identified as probable candidate for fixing in the next release label Jul 3, 2024
@rzhao271
Copy link
Contributor

rzhao271 commented Jul 8, 2024

Dragging and dropping from the Windows file explorer onto the webview even while holding down shift still opens the default application.
Dragging and dropping from the VS Code file explorer onto the webview while holding down shift does not work anymore, i.e. seems to do nothing.

@rzhao271 rzhao271 reopened this Jul 8, 2024
@rzhao271 rzhao271 added the verification-found Issue verification failed label Jul 8, 2024
@ssibrahimpur
Copy link

Kindly make an immediate release with the solution as this is blocking our production release for a plugin that uses drag drop feature.

@swordensen
Copy link
Contributor Author

swordensen commented Jul 9, 2024

@rzhao271 I saw that you mentioned the mp4's were not working so I made a youtube video commenting on the changes on my latest PR

https://youtu.be/-yHb7srObLs

Please let me know what you think and if I missed anything. Thank you

(this is video is running on #219148)

@mjbvz mjbvz removed the candidate Issue identified as probable candidate for fixing in the next release label Jul 29, 2024
@mjbvz mjbvz closed this as completed in d00533a Aug 1, 2024
@vs-code-engineering vs-code-engineering bot added the unreleased Patch has not yet been released in VS Code Insiders label Aug 1, 2024
@vs-code-engineering vs-code-engineering bot removed the unreleased Patch has not yet been released in VS Code Insiders label Aug 2, 2024
Copy link

		Issue marked as unreleased but unable to locate closing commit in issue timeline. You can manually reference a commit by commenting `\closedWith someCommitSha`, or directly add the `insiders-released` label if you know this has already been releaased

@vs-code-engineering vs-code-engineering bot added the unreleased Patch has not yet been released in VS Code Insiders label Aug 2, 2024
BABA983 pushed a commit to BABA983/vscode that referenced this issue Aug 2, 2024
* preventing default on drop events to prevent files from opening in a new window

* adding a fix that addresses microsoft#219047

---------

Co-authored-by: Matt Bierner <matb@microsoft.com>
@rzhao271 rzhao271 removed verification-found Issue verification failed unreleased Patch has not yet been released in VS Code Insiders labels Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug webview Webview issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants