diff --git a/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameUserInputComboBox.xaml b/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameUserInputComboBox.xaml
index 69a06a7bcacf0..220e01cb11e03 100644
--- a/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameUserInputComboBox.xaml
+++ b/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameUserInputComboBox.xaml
@@ -43,6 +43,11 @@
+
+
+
+
+
diff --git a/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameUserInputComboBox.xaml.cs b/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameUserInputComboBox.xaml.cs
index 3fcb2b5726837..b37c03f0e40c7 100644
--- a/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameUserInputComboBox.xaml.cs
+++ b/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameUserInputComboBox.xaml.cs
@@ -42,6 +42,7 @@ internal SmartRenameUserInputComboBox(RenameFlyoutViewModel viewModel)
});
_smartRenameViewModel.SuggestedNames.CollectionChanged += SuggestedNames_CollectionChanged;
+ AddHandler(Keyboard.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(OnItemGotKeyboardFocus), handledEventsToo: true);
}
public int TextSelectionStart
@@ -101,6 +102,16 @@ private void ComboBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventA
e.Handled = true;
}
+ private void OnItemGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
+ {
+ // When a ComboBoxItem receives keyboard focus (e.g., via Tab navigation),
+ // update the ComboBox selection to match the focused item
+ if (e.NewFocus is ComboBoxItem comboBoxItem && comboBoxItem.DataContext != null)
+ {
+ SelectedItem = comboBoxItem.DataContext;
+ }
+ }
+
private void SuggestionsPanelScrollViewer_MouseDoubleClick(object sender, MouseEventArgs e)
{
_baseViewModel.Submit();