Always show tooltips on buttons (#3521)

This PR fixes an issue where tooltips weren't being shown on selected
buttons.

We now always show tooltips on buttons that have one.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2023-12-06 16:29:35 -05:00 committed by GitHub
parent f7c995c4a0
commit 41fc30f62e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -359,11 +359,7 @@ impl RenderOnce for ButtonLike {
}, },
) )
.when_some(self.tooltip, |this, tooltip| { .when_some(self.tooltip, |this, tooltip| {
if !self.selected {
this.tooltip(move |cx| tooltip(cx)) this.tooltip(move |cx| tooltip(cx))
} else {
this
}
}) })
.children(self.children) .children(self.children)
} }

View file

@ -51,5 +51,13 @@ impl Render for IconButtonStory {
.tooltip(|cx| Tooltip::text("Open messages", cx)), .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)),
),
)
} }
} }