From f2711b2fca99e6479ab855acfe54725132e42df7 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Fri, 5 Jul 2024 14:27:53 +0200 Subject: [PATCH] ui: Don't show tooltip when ButtonLike is selected (#13857) This fixes the issue of a tooltip covering the thing that the button has revealed. It also mirrors what other UI frameworks do. Chrome on Linux behaves the same, and Safari does the same thing on macOS. It fixes this: ![Screenshot from 2024-07-05 12-39-22](https://github.com/zed-industries/zed/assets/1185253/51ce4347-d12f-463a-9adb-da031fe2f751) Release Notes: - N/A --- crates/ui/src/components/button/button_like.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/ui/src/components/button/button_like.rs b/crates/ui/src/components/button/button_like.rs index ee865fa364dfb34bcfbf7e7a1f7a6b2275b079bf..3fea9d867c5e0cf2732f12aa0e2a8581c016cdb3 100644 --- a/crates/ui/src/components/button/button_like.rs +++ b/crates/ui/src/components/button/button_like.rs @@ -507,8 +507,10 @@ impl RenderOnce for ButtonLike { }) }, ) - .when_some(self.tooltip, |this, tooltip| { - this.tooltip(move |cx| tooltip(cx)) + .when(!self.selected, |this| { + this.when_some(self.tooltip, |this, tooltip| { + this.tooltip(move |cx| tooltip(cx)) + }) }) .children(self.children) }