wry icon indicating copy to clipboard operation
wry copied to clipboard

`file_drop_handler` prevent default behaviour on Windows

Open wusyong opened this issue 2 years ago • 7 comments

So it turns out file_drop_handler will block default behaviour on Windows no matter what. But there are some new webview2 API we could use to invoke such behaviour again.

wusyong avatar Mar 14 '23 05:03 wusyong

We can edit dragndrop example to return true to test it.

wusyong avatar Mar 14 '23 05:03 wusyong

Default behavior is blocked on Linux as well.

pewsheen avatar Mar 14 '23 07:03 pewsheen

Hmm looks like wry's doc stick to the truth. We just need to update the doc in tauri configuration.

wusyong avatar Mar 14 '23 10:03 wusyong

@wusyong here is the branch I have setup for windows https://github.com/tauri-apps/wry/tree/drag-drop-webview2. I still can't get files to drop on <input> elements and after passing DragEnter to WebviewController::DragEnter, other DropTarget methods are never called.

I am not sure why this happens to be honest, maybe because we override all children of the window or something and that's why I wanted to wait for https://github.com/MicrosoftEdge/WebView2Feedback/issues/2907 but I honestly have no idea.

amrbashir avatar Mar 15 '23 16:03 amrbashir

Calling https://docs.rs/webview2-com/latest/webview2_com/Microsoft/Web/WebView2/Win32/trait.ICoreWebView2Controller4_Impl.html#tymethod.SetAllowExternalDrop didn't help either

amrbashir avatar Mar 15 '23 16:03 amrbashir

Upstream issue: https://github.com/MicrosoftEdge/WebView2Feedback/issues/2658 Looks like its not possible to get the event, and implement drop target ourselves will replace the original one for webview2.

wusyong avatar Mar 17 '23 07:03 wusyong

Any news on this? Does WebView2 expose the right APIs as of today and it's just about using them right, or are we just completely stuck still? Can we help in any way?

martpie avatar Aug 29 '24 15:08 martpie