Skip to content

Commit 548119e

Browse files
committed
Fixed clicking tab in command mode
1 parent cb5a99f commit 548119e

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/Files.App.Controls/Omnibar/Omnibar.Events.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,6 @@ private async void AutoSuggestBox_KeyDown(object sender, KeyRoutedEventArgs e)
106106
previouslyFocusedElement?.Focus(FocusState.Programmatic);
107107
}
108108
}
109-
else if (e.Key == VirtualKey.Tab && !InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down))
110-
{
111-
// Focus on inactive content when pressing Tab instead of moving to the next control in the tab order
112-
e.Handled = true;
113-
IsFocused = false;
114-
await Task.Delay(15);
115-
CurrentSelectedMode?.ContentOnInactive?.Focus(FocusState.Keyboard);
116-
}
117109
else
118110
{
119111
_textChangeReason = OmnibarTextChangeReason.UserInput;

src/Files.App/UserControls/NavigationToolbar.xaml.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Microsoft.UI.Xaml.Navigation;
1313
using Windows.AI.Actions.Hosting;
1414
using Windows.System;
15+
using Windows.UI.Core;
1516

1617
namespace Files.App.UserControls
1718
{
@@ -434,13 +435,24 @@ private void Omnibar_ModeChanged(object sender, OmnibarModeChangedEventArgs e)
434435
ViewModel.OmnibarCommandPaletteModeText = string.Empty;
435436
}
436437

437-
private void Omnibar_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
438+
private async void Omnibar_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
438439
{
439440
if (e.Key is VirtualKey.Escape)
440441
{
441442
Omnibar.IsFocused = false;
442443
(MainPageViewModel.SelectedTabItem?.TabItemContent as Control)?.Focus(FocusState.Programmatic);
443444
}
445+
else if (e.Key is VirtualKey.Tab && Omnibar.IsFocused && !InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down))
446+
{
447+
var currentSelectedMode = Omnibar.CurrentSelectedMode;
448+
Omnibar.IsFocused = false;
449+
await Task.Delay(15);
450+
451+
if (currentSelectedMode == OmnibarPathMode)
452+
BreadcrumbBar.Focus(FocusState.Keyboard);
453+
else if (Omnibar.CurrentSelectedMode == OmnibarCommandPaletteMode)
454+
OmnibarCommandPaletteMode.Focus(FocusState.Keyboard);
455+
}
444456
}
445457

446458
private void NavigationButtonOverflowFlyoutButton_LosingFocus(UIElement sender, LosingFocusEventArgs args)

0 commit comments

Comments
 (0)