microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Cannot drop files from Explorer into WebView2 in a WinUI3 app

Open michaelcapps opened this issue 2 years ago • 1 comments

Describe the bug

When using a WebView2 in a WinUI3 application the drag and drop files from File Explorer into the WebView2 functionality behaves strangely. When displaying a page that is capable of receiving files (via copy when dropping, ex: https://www.remove.bg/ ) initially I am unable to drop files into the browser at all (a red circle with a link through it appears). However, if I click into the browser to manually choose a file through the explorer/file picker, this enables the usual drag and drop behavior, even after that explorer is closed. If I then minimize the application and maximize it again (or interact with a non-browser UI element, such as clicking a button to open a flyout), I am unable to drag and drop again.

Steps to reproduce the bug

Make a new blank WinUI3 project and replace the default button with a WebView2, and set the source to a page that has a file drop control on it (such as remove.bg). Try to drag an image from File Explorer into the browser.

Expected behavior

Dragging files from the file explorer into the browser copies the file to the app.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.1.2

Windows app type

  • [ ] UWP
  • [ ] Win32

Device form factor

Desktop

Windows version

Windows 10 (21H2): Build 19044

Additional context

I reported this in the WebView2 repo and they directed me here (https://github.com/MicrosoftEdge/WebView2Feedback/issues/2546 ). This is not a new bug, it has been occurring since at least 0.8.

michaelcapps avatar Jul 13 '22 11:07 michaelcapps

Any update on this? Issue persists in WindowsAppSDK 1.2.220909.2-experimental2

michaelcapps avatar Sep 22 '22 21:09 michaelcapps

I see the same behaviour in WindowsAppsSDK version 1.2.221109.1

kbuckinx avatar Jan 31 '23 14:01 kbuckinx

Still seeing this in the latest stable 1.2 version and in the prerelease 1.3.230202101-experimental1 version.

michaelcapps avatar Feb 21 '23 20:02 michaelcapps

Would be nice if we could get this somehow on the roadmap to get fixed @bpulliam .

koenvd avatar Feb 24 '23 14:02 koenvd

Wondering if this could get some attention @gabbybilka ? Would be awesome to get this fixed.

koenvd avatar Apr 14 '23 14:04 koenvd

This is a big bug for adopting MAUI Blazor Hybrid apps.

scottkuhl avatar Apr 27 '23 21:04 scottkuhl

internal task

codendone avatar Apr 28 '23 04:04 codendone

@codendone

When can we expect a fix? The UX of all .NET Maui Blazor Hybrid apps is very much affected by this bug and many developers would be very happy to see a fix. Besides, the bug has been known for a year now and it's really about time. The worst part is that there is not even a workaround.

https://github.com/dotnet/maui/issues/2205 https://github.com/MicrosoftEdge/WebView2Feedback/issues/2805 https://github.com/dotnet/maui/issues/7390 https://www.reddit.com/r/dotnetMAUI/comments/10sk5kr/im_considering_giving_up_on_maui_blazor_hybrid/ https://stackoverflow.com/questions/73197778/net-maui-blazor-app-drag-and-drop-impossible ...

maxibyte avatar Jul 18 '23 14:07 maxibyte

@maxibyte Work is currently in progress on this, but there have been a series of issues and it is currently unclear how many more issues need to be solved to get this working. There also might still be fundamental blockers which could require larger feature work. In short, timeline isn't yet clear, other than the good news that this is currently being worked on.

codendone avatar Jul 20 '23 05:07 codendone

Wondering if there's already a better view on timeline when a fix would become available? Thanks!

koenvd avatar Aug 07 '23 15:08 koenvd

This is a huge blocker for us - we use Blazor + MAUI to build a desktop app and this is now preventing us to use drag and drop in the app. It's not just a tiny feature but everything drag and drop related cannot be done...

Ref: https://github.com/MicrosoftEdge/WebView2Feedback/issues/2805

RicoSuter avatar Aug 18 '23 14:08 RicoSuter

I just tested this in 1.4.230913002 and it's still broken, so I don't know why this was marked as fixed.

michaelcapps avatar Oct 02 '23 12:10 michaelcapps

@michaelcapps this is fixed in main branch so the fix will be available in the next release from main (1.5 experimental)

ranjeshj avatar Oct 03 '23 14:10 ranjeshj

@michaelcapps this is fixed in main branch so the fix will be available in the next release from main (1.5 experimental)

Ah I completely missed it being added to the 1.5 milestone, sorry about that. Thank you!

michaelcapps avatar Oct 05 '23 22:10 michaelcapps

Based on release notes https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/stable-channel#version-15-1 this got moved to 1.6 @codendone ? But is there any timeline around that already available?

koenvd avatar Mar 19 '24 20:03 koenvd

@koenvd It looks like we missed some detailed in the release notes:

  • Dragging into a WebView2 should now be functional in 1.5. A fix for this was checked into 1.5 shortly after 1.4 was released.
  • Dragging out of a WebView2 (or even within a WebView2, if that drag uses drag-n-drop) is still not fixed and got moved to 1.6. Fixing dragging out requires work both in core WebView2 and the XAML element. That work is still in progress.

codendone avatar Mar 21 '24 04:03 codendone