Element.current_target() always points to the HtmlBodyElement
#2572
Labels
Element.current_target() always points to the HtmlBodyElement
#2572
Environment:
wasm32-unknown-unknowntrunkI spent a long time going around in circles trying to get a handle for the html element I'm interacting with so that I can do some further processing. After a lot of print-debugging, I realised that whenever an event is received,
current_target()appears to point to theHtmlBodyElement.I would expect it to return a handle to the parent element from which the event was fired.
I reported it over at rustwasm #2849, but to save a click, the maintainer said:
Here is a minimal yew app:
Here is the Cargo.toml:
In the app I'm developing, I noticed this behaviour on an
<svg>element, to which I had added a click handler (i.e. aMouseEvent). The<svg>element has several<path>element children.Element.target()correctly gives me either the<svg>or the<path>elements, but I specifically always want the<svg>element, which is what I would expectcurrent_target()to do.The text was updated successfully, but these errors were encountered: