Skip to content

Commit

Permalink
chore: Adjustments to key handling
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Aug 22, 2024
1 parent ea346f5 commit 48a1337
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/Uno.UI/UI/Xaml/Controls/ComboBox/ComboBox.custom.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#nullable enable

using System;
using Microsoft.UI.Xaml.Automation.Peers;
using DirectUI;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
Expand Down Expand Up @@ -369,6 +369,14 @@ internal bool TryHandleKeyDown(KeyRoutedEventArgs args, ComboBoxItem? focusedCon
return false;
}

var nModifierKeys = CoreImports.Input_GetKeyboardModifiers();

// Editable and Alt key are handled in ported code.
if (IsEditable || 0 != (nModifierKeys & VirtualKeyModifiers.Menu))
{
return false;
}

if (args.Key == VirtualKey.Down)
{
if (IsDropDownOpen)
Expand Down
4 changes: 3 additions & 1 deletion src/Uno.UI/UI/Xaml/Controls/ComboBox/ComboBox.partial.mux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,13 +1692,15 @@ private void PopupKeyDown(KeyRoutedEventArgs args)
{
newFocusedIndex = newFocusedIndex < 0 ? 0 : newFocusedIndex;
}
break;
}
else if (0 != (nModifierKeys & VirtualKeyModifiers.Menu))
{
IsDropDownOpen = false;
handled = true;
break;
}
break;
goto case VirtualKey.Home;
case VirtualKey.Home:
case VirtualKey.End:
case VirtualKey.PageUp:
Expand Down

0 comments on commit 48a1337

Please sign in to comment.