Skip to content

Commit bc95b9a

Browse files
committed
fix Tab key trap
1 parent db0599a commit bc95b9a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.Input/RichSuggestBox/RichSuggestBox.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ private async void RichEditBox_ProcessKeyboardAccelerators(UIElement sender, Pro
350350

351351
private async void RichEditBox_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
352352
{
353-
if (e.Key == VirtualKey.Tab && _suggestionsList.SelectedItem != null)
353+
if (e.Key == VirtualKey.Tab && _suggestionPopup.IsOpen && _suggestionsList.SelectedItem != null)
354354
{
355355
e.Handled = true;
356356
await CommitSuggestionAsync(_suggestionsList.SelectedItem);
@@ -716,6 +716,7 @@ private void ShowSuggestionsPopup(bool show)
716716
this._suggestionChoice = 0;
717717
this._suggestionPopup.VerticalOffset = 0;
718718
this._suggestionPopup.HorizontalOffset = 0;
719+
this._suggestionsList.SelectedItem = null;
719720
this._suggestionsList.ScrollIntoView(this._suggestionsList.Items?.FirstOrDefault());
720721
UpdateCornerRadii();
721722
}

0 commit comments

Comments
 (0)