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

"fileDropEnabled" generates problems when "true" for dragging and dropping elements in the HTML - The same goes for the "Draggable" and "VueDraggableNext" components [bug] #8581

Closed
Wanderson-Magalhaes opened this issue Jan 10, 2024 · 8 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@Wanderson-Magalhaes
Copy link

Describe the bug

Video showing the bug in action - On YouYube

Bug on YouTube

I'm having a problem that I'm not finding a solution to, when I enable "fileDropEnabled" in tauri.config.json, I can get the full path of my files, the problem is that when this function is active, I can no longer use components like "Draggable " or "VueDraggableNext", I tested with both and have the same problem.
In the video above I'm using "Draggable":

import Draggable from 'vuedraggable'

Maybe there is a conflict between the native drag and drop and the "fileDropEnabled" feature, I tried several ways to get around this problem and I can't.

As unfortunately native drag and drop does not allow getting the full path of the file (not that I have found a way), I am dependent on a solution to set "fileDropEnabled" to "true" to still allow dragging and dropping files.

Reproduction

  1. Start a new application with Tauri and Vue 3 (I don't know if this problem happens in react too).
  2. Install any drag and drop component:
npm i vuedraggable
  1. create a simple example like the ones in the official documentation:
    https://www.npmjs.com/package/vuedraggable
  2. Test with "fileDropEnabled" as "false" to make sure everything is working.
  3. enable "fileDropEnabled" in tauri.config.json and you will see that after doing this you will not be able to move any more elements in the list

Expected behavior

The expected behavior would be that the "fileDropEnabled" tool works without affecting native functions or native events of the application

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 120.0.2210.121
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.69.0 (84c898d65 2023-04-16)
    ✔ cargo: 1.69.0 (6e9a83356 2023-04-12)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.16.0
    - yarn: 1.22.19
    - npm: 9.5.1

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.4.0
    - wry [RUST]: 0.24.3
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 1.5.9

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

@Wanderson-Magalhaes Wanderson-Magalhaes added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jan 10, 2024
@FabianLars
Copy link
Member

This is indeed expected behavior (that we don't want either), see tauri-apps/wry#904. We still did not find a solution that we're happy with.

There is a user-side workaround by abusing the webview's NewWindowRequested event that i've wanted to showcase for ages but never got to it. I'll see if i can get to it over the weekend, maybe it's usable for you.

@Wanderson-Magalhaes
Copy link
Author

Este é realmente um comportamento esperado (que também não queremos), consulte tauri-apps/wry#904 . Ainda não encontramos uma solução que nos satisfaça.

Há uma solução alternativa do lado do usuário, abusando do evento NewWindowRequested do webview que eu queria mostrar há muito tempo, mas nunca consegui. Vou ver se consigo fazer isso no fim de semana, talvez seja útil para você.

Thank you very much @FabianLars for all your help, any alternative solution, even temporary, is found, let us know. Because these components like Draggable help a lot with the user experience and unfortunately they will have to be inactive because I need "fileDropEnabled" to capture the entire path of files dragged via 'tauri://file-drop'.
I will leave in my application an alternative solution to move the item using up and down arrows.

@HuntFeng
Copy link

This is indeed expected behavior (that we don't want either), see tauri-apps/wry#904. We still did not find a solution that we're happy with.

There is a user-side workaround by abusing the webview's NewWindowRequested event that i've wanted to showcase for ages but never got to it. I'll see if i can get to it over the weekend, maybe it's usable for you.

Would like to see the workaround as well, any help is appreciated!

@TheBlindM
Copy link

+1

@Wanderson-Magalhaes
Copy link
Author

Any news for Tauri V2?

@DongHuiTiao
Copy link

+1

1 similar comment
@lkdm
Copy link

lkdm commented Sep 1, 2024

+1

@shijunti19
Copy link

+11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

7 participants