From d7e181576e20af68fe8d26356689aae569987fbb Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Thu, 1 May 2025 15:34:40 -0400 Subject: [PATCH] Respect cursor_pointer when a ButtonLike is disabled (#29737) This is desirable for when we want to use a `ButtonLike` to show a tooltip over an icon, and we don't want it to show the "not allowed" cursor on hover. Release Notes: - N/A --- crates/ui/src/components/button/button_like.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/ui/src/components/button/button_like.rs b/crates/ui/src/components/button/button_like.rs index 5c4ac215981dd7e17a2dee4aaf1a4942456e7808..b4907ac06264a1293254a51dc696c33f7283ecf4 100644 --- a/crates/ui/src/components/button/button_like.rs +++ b/crates/ui/src/components/button/button_like.rs @@ -535,9 +535,15 @@ impl RenderOnce for ButtonLike { ButtonSize::None => this, }) .bg(style.enabled(self.layer, cx).background) - .when(self.disabled, |this| this.cursor_not_allowed()) + .when(self.disabled, |this| { + if self.cursor_style == CursorStyle::PointingHand { + this.cursor_not_allowed() + } else { + this.cursor(self.cursor_style) + } + }) .when(!self.disabled, |this| { - this.cursor_pointer() + this.cursor(self.cursor_style) .hover(|hover| hover.bg(style.hovered(self.layer, cx).background)) .active(|active| active.bg(style.active(cx).background)) })