Skip to content

Commit 300d36e

Browse files
committed
Remove focus when pressing esc
1 parent cd0f141 commit 300d36e

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
@@ -406,5 +406,11 @@ private void Omnibar_LostFocus(object sender, RoutedEventArgs e)
406406
ViewModel.OmnibarCommandPaletteModeText = string.Empty;
407407
}
408408
}
409+
410+
private void Omnibar_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
411+
{
412+
if (e.Key is VirtualKey.Escape)
413+
Omnibar.IsFocused = false;
414+
}
409415
}
410416
}

0 commit comments

Comments
 (0)