Skip to content

Commit

Permalink
fix(autosuggestbox): fix keyboard navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
ramezgerges committed Oct 23, 2023
1 parent 2af7b1a commit ca7397f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/AutoSuggestBox/AutoSuggestBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ private void OnTextBoxKeyDown(object sender, KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Enter)
{
e.Handled = true;
if (this.Log().IsEnabled(Uno.Foundation.Logging.LogLevel.Debug))
{
this.Log().Debug($"Enter key pressed");
Expand All @@ -395,10 +396,12 @@ private void OnTextBoxKeyDown(object sender, KeyRoutedEventArgs e)
}
else if ((e.Key == Windows.System.VirtualKey.Up || e.Key == Windows.System.VirtualKey.Down) && IsSuggestionListOpen)
{
e.Handled = true;
HandleUpDownKeys(e);
}
else if (e.Key == Windows.System.VirtualKey.Escape && IsSuggestionListOpen)
{
e.Handled = true;
RevertTextToUserInput();
IsSuggestionListOpen = false;
}
Expand Down Expand Up @@ -451,6 +454,8 @@ internal void ChoseItem(Object o)
}

SuggestionChosen?.Invoke(this, new AutoSuggestBoxSuggestionChosenEventArgs(o));

_textBox?.Select(_textBox.Text.Length, 0);
}

private void RevertTextToUserInput()
Expand Down

0 comments on commit ca7397f

Please sign in to comment.