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
|
@ -168,15 +168,13 @@ impl Render for QuickActionBar {
|
|||
let focus = editor.focus_handle(cx);
|
||||
|
||||
PopoverMenu::new("editor-selections-dropdown")
|
||||
.trigger(
|
||||
.trigger_with_tooltip(
|
||||
IconButton::new("toggle_editor_selections_icon", IconName::CursorIBeam)
|
||||
.shape(IconButtonShape::Square)
|
||||
.icon_size(IconSize::Small)
|
||||
.style(ButtonStyle::Subtle)
|
||||
.toggle_state(self.toggle_selections_handle.is_deployed())
|
||||
.when(!self.toggle_selections_handle.is_deployed(), |this| {
|
||||
this.tooltip(Tooltip::text("Selection Controls"))
|
||||
}),
|
||||
.toggle_state(self.toggle_selections_handle.is_deployed()),
|
||||
Tooltip::text("Selection Controls"),
|
||||
)
|
||||
.with_handle(self.toggle_selections_handle.clone())
|
||||
.anchor(Corner::TopRight)
|
||||
|
@ -219,15 +217,13 @@ impl Render for QuickActionBar {
|
|||
let vim_mode_enabled = VimModeSetting::get_global(cx).0;
|
||||
|
||||
PopoverMenu::new("editor-settings")
|
||||
.trigger(
|
||||
.trigger_with_tooltip(
|
||||
IconButton::new("toggle_editor_settings_icon", IconName::Sliders)
|
||||
.shape(IconButtonShape::Square)
|
||||
.icon_size(IconSize::Small)
|
||||
.style(ButtonStyle::Subtle)
|
||||
.toggle_state(self.toggle_settings_handle.is_deployed())
|
||||
.when(!self.toggle_settings_handle.is_deployed(), |this| {
|
||||
this.tooltip(Tooltip::text("Editor Controls"))
|
||||
}),
|
||||
.toggle_state(self.toggle_settings_handle.is_deployed()),
|
||||
Tooltip::text("Editor Controls"),
|
||||
)
|
||||
.anchor(Corner::TopRight)
|
||||
.with_handle(self.toggle_settings_handle.clone())
|
||||
|
|
|
@ -209,16 +209,16 @@ impl QuickActionBar {
|
|||
})
|
||||
.into()
|
||||
})
|
||||
.trigger(
|
||||
.trigger_with_tooltip(
|
||||
ButtonLike::new_rounded_right(element_id("dropdown"))
|
||||
.child(
|
||||
Icon::new(IconName::ChevronDownSmall)
|
||||
.size(IconSize::XSmall)
|
||||
.color(Color::Muted),
|
||||
)
|
||||
.tooltip(Tooltip::text("REPL Menu"))
|
||||
.width(rems(1.).into())
|
||||
.disabled(menu_state.popover_disabled),
|
||||
Tooltip::text("REPL Menu"),
|
||||
);
|
||||
|
||||
let button = ButtonLike::new_rounded_left("toggle_repl_icon")
|
||||
|
@ -343,8 +343,8 @@ impl QuickActionBar {
|
|||
.color(Color::Muted)
|
||||
.size(IconSize::XSmall),
|
||||
),
|
||||
)
|
||||
.tooltip(Tooltip::text("Select Kernel")),
|
||||
),
|
||||
Tooltip::text("Select Kernel"),
|
||||
)
|
||||
.with_handle(menu_handle.clone())
|
||||
.into_any_element()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue