From ab3e296920b845301830fa0fe65fe53a14be62ff Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:06:14 -0600 Subject: [PATCH] Fix tooltips sometimes continuously displaying when the button is selected (cherry-pick #14832) (#14835) Cherry-picked Fix tooltips sometimes continuously displaying when the button is selected (#14832) Release Notes: - Fixed sometime tooltip will continuously display when the button is selected. --- @mrnugget The #13857 This change has led into a bug, the selected item before tooltip will continuous display if there are no other tooltips. https://github.com/user-attachments/assets/06b4a9a4-dede-4c18-b020-e20b6090341f Co-authored-by: Jason Lee --- crates/gpui/src/elements/div.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rs index ad6d7a162c1499bca635cd0039e89cd4bcf00dbd..f76f1c702e7c6046beb2e2061f939da028d4293f 100644 --- a/crates/gpui/src/elements/div.rs +++ b/crates/gpui/src/elements/div.rs @@ -1866,6 +1866,11 @@ impl Interactivity { }); } + // Ensure to remove active tooltip if tooltip builder is none + if self.tooltip_builder.is_none() { + element_state.active_tooltip.take(); + } + if let Some(tooltip_builder) = self.tooltip_builder.take() { let tooltip_is_hoverable = tooltip_builder.hoverable; let active_tooltip = element_state