Use a handler instead of an action for clicks
This prevents dispatching actions on buttons that were not the target of the click. Co-Authored-By: Marshall <marshall@zed.dev>
This commit is contained in:
parent
e4884f1d76
commit
cc9eff89f5
5 changed files with 48 additions and 40 deletions
|
@ -724,7 +724,10 @@ impl Render for PanelButtons {
|
|||
.trigger(
|
||||
IconButton::new(name, icon)
|
||||
.selected(is_active_button)
|
||||
.action(action.boxed_clone())
|
||||
.on_click({
|
||||
let action = action.boxed_clone();
|
||||
move |_, cx| cx.dispatch_action(action.boxed_clone())
|
||||
})
|
||||
.tooltip(move |cx| {
|
||||
Tooltip::for_action(tooltip.clone(), &*action, cx)
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue