tauri-apps/tauri

[docs] is disable_drag_drop_handler really only for Windows?

petersamokhin opened this issue · 3 comments

Hello! The below builder fn says it's required for Windows only, but even on macOS this parameter is required to handle drag-n-drop inside HTML, instead of listening for tauri events.
Is the below documentation correct and I miss something? Or should the comment be updated?

/// Disables the drag and drop handler. This is required to use HTML5 drag and drop APIs on the frontend on Windows.
#[must_use]
pub fn disable_drag_drop_handler(mut self) -> Self {
  self.webview_builder = self.webview_builder.disable_drag_drop_handler();
  self
}

It's a bit weird tbh. First of all, it's correct on a lower level. Only Window has a limitation we can't get around. But something seems to be a bit broken because you're by far not the first one reporting that this api has implications on macos or linx, but it's not true for everyone so i'm not really sure what's going on tbh.

@FabianLars in case I misunderstood something: are the HTML-only onDrop and onDragOver listeners supposed to work without using disable_drag_drop_handler()? If yes, then what I faced on macOS is a bug?

Asking just to understand what will be the most reliable option to handle file drops.
Do I have to use window listen events? Or is there a chance to make HTML events work reliably on Windows + macOS + Linux?

As discussed in Discord:

  • if you need file paths, you have to use Tauri events, because in HTML drag'n'drop events you won't access them
  • Windows support likely rules out availability of HTML events
  • tauri events are pretty reliable and should work on all platforms
    • devtools bug is likely unfixable but doesn't affect release apps
    • macos titlebar offset can be fixed
      My questions are solved, will have to use Tauri events.