fix: only wrap hover/active elements in button when __on:click exists (no more phantom pointer cursor)
This commit is contained in:
@@ -82,17 +82,18 @@ fn make_hoverable<'a>(
|
||||
return widget;
|
||||
}
|
||||
|
||||
let click_script = el.get_prop("__on:click").map(String::from);
|
||||
|
||||
if click_script.is_none() {
|
||||
return widget;
|
||||
}
|
||||
|
||||
let hover = hover_props.clone();
|
||||
let active = active_props.clone();
|
||||
let cs = base_cs.clone();
|
||||
|
||||
let mut btn = button(widget).padding(0);
|
||||
|
||||
if let Some(script) = el.get_prop("__on:click") {
|
||||
btn = btn.on_press(crate::Message::EventTriggered(script.to_string()));
|
||||
} else if has_hover || has_active {
|
||||
btn = btn.on_press(crate::Message::EventTriggered(String::new()));
|
||||
}
|
||||
btn = btn.on_press(crate::Message::EventTriggered(click_script.unwrap()));
|
||||
|
||||
btn.style(move |_, status| {
|
||||
let mut style_cs = cs.clone();
|
||||
|
||||
Reference in New Issue
Block a user