bevyengine / bevyengine/bevy

Drag and drop with WASM target

Open
#6,822 6 comments 2 reactions 0 assignees View on GitHub
C-Bug C-Docs C-Examples O-Web S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

(not sure if a bug or feature request)

## Bevy version

`bevy = "0.9.0"`

## What you did

I have a drag and drop system reading form FileDragAndDrop.

```rust
fn file_drop(
mut dnd_evr: EventReader,
asset_server: Res,
/// etc.
) {}
```

This works perfectly fine for native targets: whenever I drag-and-drop a JSON, it takes it and processes it.
However, when compiled for WASM, the browser (tried in firefox, chromium) takes control of the drag and drop, rendering the JSON on screen.

## What went wrong

- what were you expecting?
I was expecting the FileDragAndDrop event to be triggered as with the native targets.
- what actually happened?
The event is never triggered, the browser takes control of drag and drop.

## Additional information
Maybe there's a way to disallow this behavior on the browser via Javascript without touching anything in Bevy?

Contributor guide

Open the contributing guide

Research direction

Start by reading the WASM handling for the FileDragAndDrop event and reproduce the behavior in Firefox or Chromium using the reported Bevy 0.9.0 example. Compare it with a native target; done means a dropped JSON triggers FileDragAndDrop in WASM instead of being rendered by the browser.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.