settings_ui: Fix focus bugs (#40806)

Closes #40608


Release Notes:

- settings_ui: Fixed an issue where tabbing to the nav bar from the
search bar while the nav bar was scrolled would result in the first
_visible_ nav entry being selected, instead of the literal first nav
entry
- settings_ui: Fixed an issue where scrolling the selected nav entry off
screen would cause the keyboard shortcut hint for the focus nav / focus
content binding to dissapear
- settings_ui: Fixed an issue where text input controls could not be
focused via the keyboard
This commit is contained in:
Ben Kunkle
2025-10-21 12:25:07 -04:00
committed by GitHub
parent d7ffc37b14
commit cf8422f7fd
2 changed files with 37 additions and 8 deletions
+5 -4
View File
@@ -62,10 +62,6 @@ impl RenderOnce for SettingsEditor {
}
});
if let Some(tab_index) = self.tab_index {
editor.focus_handle(cx).tab_index(tab_index);
}
let weak_editor = editor.downgrade();
let theme_colors = cx.theme().colors();
@@ -78,6 +74,11 @@ impl RenderOnce for SettingsEditor {
.border_1()
.border_color(theme_colors.border)
.bg(theme_colors.editor_background)
.when_some(self.tab_index, |this, tab_index| {
let focus_handle = editor.focus_handle(cx).tab_index(tab_index).tab_stop(true);
this.track_focus(&focus_handle)
.focus(|s| s.border_color(theme_colors.border_focused))
})
.child(editor)
.when_some(self.confirm, |this, confirm| {
this.on_action::<menu::Confirm>({