Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Accelerators to all Visual Elements #16202

Open
Tracked by #16799 ...
PureWeen opened this issue Jul 17, 2023 · 4 comments
Open
Tracked by #16799 ...

Add Accelerators to all Visual Elements #16202

PureWeen opened this issue Jul 17, 2023 · 4 comments
Labels
area-keyboard Keyboard, soft keyboard partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with proposal/open
Milestone

Comments

@PureWeen
Copy link
Member

Description

We've added Accelerators to MenuItems #5211.

This spec proposes adding Accelerators to VisualElement. WinUI and Catalyst both support Accelerators at the base view level.

This spec is partially in response to #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 a Generic keyboard listener, is that this this lets the OS know what KeyCommands 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

API Description
Accelerators Bindable Property that let's you set as many Accelerators as you want.

Usage Scenarios

<StackLayout>
     <StackLayout.Accelerators>
                 <Accelerator Invoked="OnInvoked" Key="f" Modifiers="ctrl+space">
     </StackLayout.Accelertors>
</StackLayout>

Backward Compatibility

N/A

Difficulty

Medium

@ghost
Copy link

ghost commented Jul 27, 2023

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.

@mikeparker104 mikeparker104 added the partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with label Aug 2, 2023
@samhouts samhouts modified the milestones: Backlog, .NET 9 Planning Sep 26, 2023
@egvijayanand
Copy link
Contributor

egvijayanand commented Dec 20, 2023

Referring to this issue here: #18782

More details in the comments, AccessKey property.

@taublast
Copy link
Contributor

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

@PureWeen
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-keyboard Keyboard, soft keyboard partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with proposal/open
Projects
None yet
Development

No branches or pull requests

6 participants