From 61d584db450dda88f43c3c8a384c99e367d2a8e1 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 3 Mar 2025 08:59:42 -0300 Subject: [PATCH] context menu: Adjust item disabled state when there is docs aside (#25860) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a context menu item has a documentation aside element attached to it, we're now hiding the keybinding (which wouldn't trigger anything anyway) to make room for displaying an info icon, with the purpose of indicating the existence of the docs aside, which will typically explain the reason why the item’s disabled in the first place. Also, changed the label color to use the `Disabled` token; more appropriate for this, and just slightly darker, which is great! Release Notes: - N/A --- crates/ui/src/components/context_menu.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs index 84cdbdff4c..3d003200c1 100644 --- a/crates/ui/src/components/context_menu.rs +++ b/crates/ui/src/components/context_menu.rs @@ -614,7 +614,7 @@ impl Render for ContextMenu { }; let label_color = if *disabled { - Color::Muted + Color::Disabled } else { Color::Default }; @@ -659,7 +659,7 @@ impl Render for ContextMenu { div() .id(("context-menu-child", ix)) .when_some( - documentation_aside_callback, + documentation_aside_callback.clone(), |this, documentation_aside_callback| { this.occlude().on_hover(cx.listener( move |menu, hovered, _, cx| { @@ -732,10 +732,16 @@ impl Render for ContextMenu { }) .map(|binding| { div().ml_4().child(binding) + .when(*disabled && documentation_aside_callback.is_some(), |parent| { + parent.invisible() + }) }) }, ), - ), + ) + .when(*disabled && documentation_aside_callback.is_some(), |parent| { + parent.child(Icon::new(IconName::Info).size(IconSize::XSmall).color(Color::Muted)) + }), ) .on_click({ let context =