Skip to content

Commit 86d375b

Browse files
committed
Fixed right clicking in Command mode
1 parent fad37df commit 86d375b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ private void AutoSuggestBox_LosingFocus(UIElement sender, LosingFocusEventArgs a
3232
args.TryCancel();
3333
return;
3434
}
35-
else
36-
{
37-
// Reset to the default mode when Omnibar loses focus
38-
CurrentSelectedMode = Modes?.FirstOrDefault();
39-
}
4035
}
4136

4237
private void AutoSuggestBox_GotFocus(object sender, RoutedEventArgs e)
@@ -50,12 +45,16 @@ private void AutoSuggestBox_GotFocus(object sender, RoutedEventArgs e)
5045
private void AutoSuggestBox_LostFocus(object sender, RoutedEventArgs e)
5146
{
5247
// TextBox still has focus if the context menu for selected text is open
53-
if (_textBox.ContextFlyout.IsOpen)
54-
return;
55-
48+
var element = Microsoft.UI.Xaml.Input.FocusManager.GetFocusedElement(this.XamlRoot);
49+
if (element is FlyoutBase or Popup)
50+
return;
51+
5652
GlobalHelper.WriteDebugStringForOmnibar("The TextBox lost the focus.");
5753

5854
IsFocused = false;
55+
56+
// Reset to the default mode when Omnibar loses focus
57+
CurrentSelectedMode = Modes?.FirstOrDefault();
5958
}
6059

6160
private async void AutoSuggestBox_KeyDown(object sender, KeyRoutedEventArgs e)

0 commit comments

Comments
 (0)