Fix hover tooltips appearing after related element is pressed (#24540)
Closes https://github.com/zed-industries/zed/issues/23894
Reworks all trigger declarations from
`.trigger(element.tooltip(tooltip))` into
`.trigger_with_tooltip(element, tooltip)` , with new API disallowing
simultaneous trigger and tooltip display.
All existing `.trigger(` calls were replaced, except 2 not applicable
(in dock.rs and pane.rs), 15 left as ones without tooltips, and 2
unchanged places in `inline_completion_button.rs`, where
0f7bb2e9fd/crates/inline_completion_button/src/inline_completion_button.rs (L311-L319)
`with_animation` does not allow us to simply use the same approach.
Release Notes:
- Fixed hover tooltips appearing after related element is pressed
---------
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
parent
1a133ab9d8
commit
6f7f0f30e2
21 changed files with 218 additions and 180 deletions
|
@ -133,16 +133,14 @@ impl ApplicationMenu {
|
|||
.menu(move |window, cx| {
|
||||
Self::build_menu_from_items(entry.clone(), window, cx).into()
|
||||
})
|
||||
.trigger(
|
||||
.trigger_with_tooltip(
|
||||
IconButton::new(
|
||||
SharedString::from(format!("{}-menu-trigger", menu_name)),
|
||||
ui::IconName::Menu,
|
||||
)
|
||||
.style(ButtonStyle::Subtle)
|
||||
.icon_size(IconSize::Small)
|
||||
.when(!handle.is_deployed(), |this| {
|
||||
this.tooltip(Tooltip::text("Open Application Menu"))
|
||||
}),
|
||||
.icon_size(IconSize::Small),
|
||||
Tooltip::text("Open Application Menu"),
|
||||
)
|
||||
.with_handle(handle),
|
||||
)
|
||||
|
|
|
@ -690,7 +690,7 @@ impl TitleBar {
|
|||
})
|
||||
.into()
|
||||
})
|
||||
.trigger(
|
||||
.trigger_with_tooltip(
|
||||
ButtonLike::new("user-menu")
|
||||
.child(
|
||||
h_flex()
|
||||
|
@ -706,8 +706,8 @@ impl TitleBar {
|
|||
.color(Color::Muted),
|
||||
),
|
||||
)
|
||||
.style(ButtonStyle::Subtle)
|
||||
.tooltip(Tooltip::text("Toggle User Menu")),
|
||||
.style(ButtonStyle::Subtle),
|
||||
Tooltip::text("Toggle User Menu"),
|
||||
)
|
||||
.anchor(gpui::Corner::TopRight)
|
||||
} else {
|
||||
|
@ -736,10 +736,9 @@ impl TitleBar {
|
|||
})
|
||||
.into()
|
||||
})
|
||||
.trigger(
|
||||
IconButton::new("user-menu", IconName::ChevronDown)
|
||||
.icon_size(IconSize::Small)
|
||||
.tooltip(Tooltip::text("Toggle User Menu")),
|
||||
.trigger_with_tooltip(
|
||||
IconButton::new("user-menu", IconName::ChevronDown).icon_size(IconSize::Small),
|
||||
Tooltip::text("Toggle User Menu"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue