Skip to content

Commit d57ebac

Browse files
committed
Remove focus when pressing esc
1 parent 11e2f0b commit d57ebac

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Files.App/UserControls/NavigationToolbar.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@
325325
CurrentSelectedModeName="{x:Bind ViewModel.OmnibarCurrentSelectedModeName, Mode=TwoWay}"
326326
IsFocused="{x:Bind ViewModel.IsOmnibarFocused, Mode=TwoWay}"
327327
LostFocus="Omnibar_LostFocus"
328+
PreviewKeyDown="Omnibar_PreviewKeyDown"
328329
QuerySubmitted="Omnibar_QuerySubmitted"
329330
TextChanged="Omnibar_TextChanged">
330331

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,5 +429,11 @@ private void Omnibar_LostFocus(object sender, RoutedEventArgs e)
429429
ViewModel.OmnibarCommandPaletteModeText = string.Empty;
430430
}
431431
}
432+
433+
private void Omnibar_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
434+
{
435+
if (e.Key is VirtualKey.Escape)
436+
Omnibar.IsFocused = false;
437+
}
432438
}
433439
}

0 commit comments

Comments
 (0)