From d6a06b6ba3dd8c15d668f362f3198b2e57b4f06b Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Thu, 9 Oct 2025 11:58:44 -0700 Subject: [PATCH] settings_ui: Restore settings UI keybinding hint (#39896) Now that the toggle nav focus works well, we can advertise it! Release Notes: - N/A --- crates/settings_ui/src/settings_ui.rs | 57 +++++++++++++++------------ 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index 63a7293e4765165f5636a337cd0eb27433613667..9d165239c897eaca09df7e5c60e3546e5c421af1 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -30,8 +30,9 @@ use std::{ sync::{Arc, LazyLock, RwLock, atomic::AtomicBool}, }; use ui::{ - ContextMenu, Divider, DividerColor, DropdownMenu, DropdownStyle, IconButtonShape, PopoverMenu, - Switch, SwitchColor, Tooltip, TreeViewItem, WithScrollbar, prelude::*, + ContextMenu, Divider, DividerColor, DropdownMenu, DropdownStyle, IconButtonShape, KeyBinding, + KeybindingHint, PopoverMenu, Switch, SwitchColor, Tooltip, TreeViewItem, WithScrollbar, + prelude::*, }; use ui_input::{NumberField, NumberFieldType}; use util::{ResultExt as _, paths::PathStyle, rel_path::RelPath}; @@ -1412,11 +1413,16 @@ impl SettingsWindow { ) -> impl IntoElement { let visible_count = self.visible_navbar_entries().count(); - // let focus_keybind_label = if self.navbar_focus_handle.contains_focused(window, cx) { - // "Focus Content" - // } else { - // "Focus Navbar" - // }; + let focus_keybind_label = if self + .navbar_focus_handle + .read(cx) + .handle + .contains_focused(window, cx) + { + "Focus Content" + } else { + "Focus Navbar" + }; v_flex() .w_64() @@ -1549,25 +1555,24 @@ impl SettingsWindow { ) .vertical_scrollbar_for(self.list_handle.clone(), window, cx), ) - // TODO: Restore this once we've fixed the ToggleFocusNav action - // .child( - // h_flex() - // .w_full() - // .p_2() - // .pb_0p5() - // .flex_none() - // .border_t_1() - // .border_color(cx.theme().colors().border_variant) - // .children( - // KeyBinding::for_action(&ToggleFocusNav, window, cx).map(|this| { - // KeybindingHint::new( - // this, - // cx.theme().colors().surface_background.opacity(0.5), - // ) - // .suffix(focus_keybind_label) - // }), - // ), - // ) + .child( + h_flex() + .w_full() + .p_2() + .pb_0p5() + .flex_none() + .border_t_1() + .border_color(cx.theme().colors().border_variant) + .children( + KeyBinding::for_action(&ToggleFocusNav, window, cx).map(|this| { + KeybindingHint::new( + this, + cx.theme().colors().surface_background.opacity(0.5), + ) + .suffix(focus_keybind_label) + }), + ), + ) } fn open_and_scroll_to_navbar_entry(