Skip to content

Commit 9396532

Browse files
committed
Update
1 parent 5ddb463 commit 9396532

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ private void AutoSuggestBox_LosingFocus(UIElement sender, LosingFocusEventArgs a
3030
args.TryCancel();
3131
return;
3232
}
33+
34+
if (args.InputDevice is FocusInputDeviceKind.Keyboard || args.Direction is FocusNavigationDirection.Next or FocusNavigationDirection.Previous)
35+
{
36+
CurrentSelectedMode?.ContentOnInactive?.Focus(FocusState.Keyboard);
37+
}
3338
}
3439

3540
private void AutoSuggestBox_GotFocus(object sender, RoutedEventArgs e)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ protected void ChangeMode(OmnibarMode? oldMode, OmnibarMode newMode)
124124
// Add the reposition transition to the all modes
125125
mode.Transitions = [new RepositionThemeTransition()];
126126
mode.UpdateLayout();
127-
mode.IsTabStop = true;
128127
}
129128

130129
var index = _modesHostGrid.Children.IndexOf(newMode);
@@ -154,7 +153,6 @@ protected void ChangeMode(OmnibarMode? oldMode, OmnibarMode newMode)
154153
ChangeTextBoxText(newMode.Text ?? string.Empty);
155154

156155
VisualStateManager.GoToState(newMode, "Focused", true);
157-
newMode.IsTabStop = false;
158156

159157
ModeChanged?.Invoke(this, new(oldMode, newMode!));
160158

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ namespace Files.App.Controls
77
{
88
public partial class OmnibarMode
99
{
10+
private void ModeButton_KeyDown(object sender, KeyRoutedEventArgs e)
11+
{
12+
if (_ownerRef is null || _ownerRef.TryGetTarget(out var owner) is false || owner.CurrentSelectedMode == this)
13+
return;
14+
15+
if (e.Key is Windows.System.VirtualKey.Enter)
16+
{
17+
owner.CurrentSelectedMode = this;
18+
}
19+
}
20+
1021
private void ModeButton_PointerEntered(object sender, PointerRoutedEventArgs e)
1122
{
1223
if (_ownerRef is null || _ownerRef.TryGetTarget(out var owner) is false || owner.CurrentSelectedMode == this)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ protected override void OnApplyTemplate()
3535
?? throw new MissingFieldException($"Could not find {TemplatePartName_ModeButton} in the given {nameof(OmnibarMode)}'s style.");
3636

3737
Loaded += OmnibarMode_Loaded;
38+
_modeButton.KeyDown += ModeButton_KeyDown;
3839
_modeButton.PointerEntered += ModeButton_PointerEntered;
3940
_modeButton.PointerPressed += ModeButton_PointerPressed;
4041
_modeButton.PointerReleased += ModeButton_PointerReleased;

0 commit comments

Comments
 (0)