It is impossible to perform preventDefault, etc. due to the wrapper structs.
It would be great if yew passed the event from stdweb directly. The impact should be minimal and hopefully this would not affect the Msg return values used elsewhere.
Resonable :+1: I think it's time to test your idea. Thank you!
I notice that the v0.4 is released, but the issue is still tagged with milestone 0.4.0.
I, too, am confused about this issue's status, as 0.4.0 was released last month.
This seems to be working for me.
onclick=|e| { e.prevent_default(); Message::Toggle }
In which version?
I don't know why it doesn't show up in the yew docs, but ClickEvent is actually reexported from stdweb, and in the stdweb docs it implements the stdweb traits IMouseEvent, IUiEvent, IEvent. IEvent has prevent_default on it.
I get a
no method named
prevent_defaultfound for typeyew::SubmitEventin the current scope`
The same thing happens if it's a ClickEvent. Tried using yew versions 0.4, 0.5, 0.6 and master.
Maybe you need to run cargo update to update your stdweb? It's working for me: https://github.com/mdonoughe/sbzdeck/blob/07ae2745bf6b3d0875e9a983ed51f70655e56c78/inspector/src/feature.rs#L76
Edit: or try use stdweb::traits::IEvent;?
use stdweb::traits::IEvent; worked!
So if wanted to do a drag and drop type thing then I shouldn't use yew? because it doesn't expose any way to deal with the browser drag and drop effects. I can't set the dataTransfer etc.
EDIT: it turns out that the yew event types implement the interfaces that the stdweb event types do, but the docs just don't show that. So using the yew event as a stdweb event worked just fine you just have to use the interface you want to use.
Most helpful comment
Resonable :+1: I think it's time to test your idea. Thank you!