Issues with multiple prevent_default attributes
Problem
As per the docs/examples it seems to be possible to prevent multiple defaults in the same element, but it is only working for the last one defined.
Steps To Reproduce
Steps to reproduce the behavior:
- Run and open in the browser the following app (see below)
- Drag and drop a file
use dioxus::prelude::*;
fn main() {
tracing_wasm::set_as_global_default();
dioxus_web::launch(app);
}
fn app(cx: Scope) -> Element {
cx.render(rsx!(
div {
ondrop: |_| tracing::info!("On drop"),
ondragover: |_| tracing::info!("On drag over"),
prevent_default: "ondrop",
prevent_default: "ondragover",
style: "border: 1px solid black; width: 300px; height: 200px;",
"Drag and drop a file"
}
))
}
Expected behavior
It should prevent the browser from opening the file and just show the logs, but it is instead opening the file, tested in Chrome and Safari.
Environment:
- Dioxus version:
master-> 8347de59565d39a275959accd441c27bc460c8d1 - Rust version: 1.63.0
- OS info: MacOS
- App platform:
web
Questionnaire
- [ ] I'm interested in fixing this myself but don't know where to start
- [ ] I would like to fix and I have a solution
- [ ] I don't have time to fix this right now, but maybe later
I have a vague memory of preventing multiple defaults by putting the names in one str and separating them with or ,, do you could try that.
I might be mistaken though.
The current docs discuss multiple prevent default values, but no other attributes are combined in this way. There are other attributes where this could make sense like (multiple style attributes). It could be both easier and more consistent to implement a separator instead of duplicate attributes