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

desktop_drop 0.5.0 - Web doesn not receive image, instead, browser opens the file in a new tab #368

Open
Eerey opened this issue Sep 23, 2024 · 1 comment

Comments

@Eerey
Copy link

Eerey commented Sep 23, 2024

When an image is dragged from the file system (Windows, Desktop Explorer) to web (Flutter with CanvasKit), the DropTarget does not trigger and the image is opened in a new tab.

Tested in Chrome and Firefox (most recent update).

@Santiago-Czop
Copy link

Santiago-Czop commented Oct 8, 2024

In Windows, while debugging on Chrome, the behaviour is the expected one. On the release version (Flutter with CanvasKIT) accessed through a server, the browser (Chrome and Opera GX) blocks the behaviour so the dropped files are simply downloaded or opened (if the browser can open them).

You can solve this by disabling the default behaviour from the browsers. I did this by adding this lines on web/index.html, inside the tag.

<script>
      document.addEventListener('dragover', function(event) {
        event.preventDefault();
      }, false);

      document.addEventListener('drop', function(event) {
        event.preventDefault();
      }, false);
</script>

This seems to solve the issue and I haven't come across any side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants