Open PureWeen opened 1 year ago
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Referring to this issue here: #18782
More details in the comments, AccessKey property.
Why not capture all keyboard keys globally at App level, then every VisualElement can subscribe to them/whatever?
I have a working implementation for such capture in MAUI for Windows and MacCatalist, it could serve as a base.
https://github.com/taublast/DrawnUi.Maui/tree/main/src/Engine/Features/Keyboard
Why not capture all keyboard keys globally at App level, then every VisualElement can subscribe to them/whatever? I have a working implementation for such capture in MAUI for Windows and MacCatalist, it could serve as a base. https://github.com/taublast/DrawnUi.Maui/tree/main/src/Engine/Features/Keyboard
Accelerators are a very specific concept that doesn't really map to a global listener.
For example, WinUI has a specific KeyboardAcccelerator property on the UIElement itself https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.uielement.keyboardaccelerators?view=winrt-26100.
The reason for this is that this now tells the OS the combination of keys that are associated with this element.
If you were to do this via a global listener then this isn't discoverable by the OS. Doing accelerators via the correct APIs is necessary for accessibility and discoverability.
Similarly all UIResponders on iOS have https://developer.apple.com/documentation/uikit/uiresponder/1621141-keycommands
Handling key combinations at the app level isn't going to be implicitly discoverable
Description
We've added Accelerators to MenuItems https://github.com/dotnet/maui/issues/5211.
This spec proposes adding
Accelerators
toVisualElement
. WinUI and Catalyst both supportAccelerators
at the base view level.This spec is partially in response to https://github.com/dotnet/maui/issues/12004 where
Accelerators
will give users much more fine-grained control at the view level vs at a global level.One of the primary reasons to use
Accelerators
over aGeneric
keyboard listener, is that this this lets the OS know whatKeyCommands
you've implemented short cut behavior against. With this information the OS can provide information to readers and better visual hints about available commands.(Public) API Changes
VisualElement
Properties
Accelerators
as you want.Usage Scenarios
Backward Compatibility
N/A
Difficulty
Medium