Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Always show tooltips on buttons (#3521)

Marshall Bowers41fc30f62e73
diff --git a/crates/ui2/src/components/button/button_like.rs b/crates/ui2/src/components/button/button_like.rs
index 4bef6bff774..1a33eb2845e 100644
--- a/crates/ui2/src/components/button/button_like.rs
+++ b/crates/ui2/src/components/button/button_like.rs
@@ -359,11 +359,7 @@ impl RenderOnce for ButtonLike {
},
)
.when_some(self.tooltip, |this, tooltip| {
- if !self.selected {
- this.tooltip(move |cx| tooltip(cx))
- } else {
- this
- }
+ this.tooltip(move |cx| tooltip(cx))
})
.children(self.children)
}
diff --git a/crates/ui2/src/components/stories/icon_button.rs b/crates/ui2/src/components/stories/icon_button.rs
index 3c4d68f8aff..583f453d188 100644
--- a/crates/ui2/src/components/stories/icon_button.rs
+++ b/crates/ui2/src/components/stories/icon_button.rs
@@ -51,5 +51,13 @@ impl Render for IconButtonStory {
.tooltip(|cx| Tooltip::text("Open messages", cx)),
),
)
+ .child(Story::label("Selected with `tooltip`"))
+ .child(
+ div().w_8().child(
+ IconButton::new("selected_with_tooltip", Icon::InlayHint)
+ .selected(true)
+ .tooltip(|cx| Tooltip::text("Toggle inlay hints", cx)),
+ ),
+ )
}
}