Fix event closure invoked recursively (#3405)

This commit is contained in:
Evan Almloff authored and GitHub committed 2024-12-20 12:01:31 -08:00
1 parent aab1258f0e
commit ecf8d16f3e
1 file changed
+4 -1
+4 -1
View File
@@ -80,7 +80,10 @@ impl WebsysDom {
let interpreter = Interpreter::default();
let handler: Closure<dyn FnMut(&Event)> = Closure::wrap(Box::new({
// The closure type we pass to the dom may be invoked recursively if one event triggers another. For example,
// one event could focus another element which triggers the focus event of the new element like inhttps://github.com/DioxusLabs/dioxus/issues/2882.
// The Closure<dyn Fn(_)> type can invoked recursively, but Closure<dyn FnMut()> cannot
let handler: Closure<dyn Fn(&Event)> = Closure::wrap(Box::new({
let runtime = runtime.clone();
move |web_sys_event: &web_sys::Event| {
let name = web_sys_event.type_();