Repository: files-community/Files
File: src/Files.App.Controls/Omnibar/Omnibar.Events.cs (C#)

Code before:
					_textBoxSuggestionsListView.SelectedIndex = nextIndex;

					ChooseSuggestionItem(_textBoxSuggestionsListView.SelectedItem, true);
				}
			}
			else if (e.Key == VirtualKey.Escape)
			{
				e.Handled = true;

				if (_textBoxSuggestionsPopup.IsOpen)
				{
					RevertTextToUserInput();
					_textBoxSuggestionsPopup.IsOpen = false;
				}
				else
				{
					_previouslyFocusedElement.TryGetTarget(out var previouslyFocusedElement);
					previouslyFocusedElement?.Focus(FocusState.Programmatic);
				}
			}
			else if (e.Key == VirtualKey.Tab && !InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down))
			{
				e.Handled = true;
				IsFocused = false;
				await Task.Delay(15);
				CurrentSelectedMode?.ContentOnInactive?.Focus(FocusState.Keyboard);
			}
			else
			{
				_textChangeReason = OmnibarTextChangeReason.UserInput;
			}
		}

		private void AutoSuggestBox_TextChanged(object sender, TextChangedEventArgs e)
		{
			if (string.Compare(_textBox.Text, CurrentSelectedMode!.Text, StringComparison.OrdinalIgnoreCase) is not 0)
				CurrentSelectedMode!.Text = _textBox.Text;

			// UpdateSuggestionListView();

			if (_textChangeReason is not OmnibarTextChangeReason.SuggestionChosen and
				not OmnibarTextChangeReason.ProgrammaticChange)
			{
				_textChangeReason = OmnibarTextChangeReason.UserInput;
				_userInput = _textBox.Text;
			}

			TextChanged?.Invoke(this, new(CurrentSelectedMode, _textChangeReason));

			// Reset
			_textChangeReason = OmnibarTextChangeReason.None;

Review comment (suggestion):
```suggestion

				// NOTE: This is a workaround to prevent the focus moves to an inappropriate element
				await Task.Delay(15);

```

Code after:
					_textBoxSuggestionsListView.SelectedIndex = nextIndex;

					ChooseSuggestionItem(_textBoxSuggestionsListView.SelectedItem, true);
				}
			}
			else if (e.Key == VirtualKey.Escape)
			{
				e.Handled = true;

				if (_textBoxSuggestionsPopup.IsOpen)
				{
					RevertTextToUserInput();
					_textBoxSuggestionsPopup.IsOpen = false;
				}
				else
				{
					_previouslyFocusedElement.TryGetTarget(out var previouslyFocusedElement);
					previouslyFocusedElement?.Focus(FocusState.Programmatic);
				}
			}
			else if (e.Key == VirtualKey.Tab && !InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down))
			{
				// Focus on inactive content when pressing Tab instead of moving to the next control in the tab order
				e.Handled = true;
				IsFocused = false;
				await Task.Delay(15);
				CurrentSelectedMode?.ContentOnInactive?.Focus(FocusState.Keyboard);
			}
			else
			{
				_textChangeReason = OmnibarTextChangeReason.UserInput;
			}
		}

		private void AutoSuggestBox_TextChanged(object sender, TextChangedEventArgs e)
		{
			if (string.Compare(_textBox.Text, CurrentSelectedMode!.Text, StringComparison.OrdinalIgnoreCase) is not 0)
				CurrentSelectedMode!.Text = _textBox.Text;

			// UpdateSuggestionListView();

			if (_textChangeReason is not OmnibarTextChangeReason.SuggestionChosen and
				not OmnibarTextChangeReason.ProgrammaticChange)
			{
				_textChangeReason = OmnibarTextChangeReason.UserInput;
				_userInput = _textBox.Text;
			}

			TextChanged?.Invoke(this, new(CurrentSelectedMode, _textChangeReason));

			// Reset