This document is focused primarily on dealing with keyboard shortcuts, but it could be expanded to various other gestures such as touch gestures, etc.
First, let's list the types of scenarios we run into with real apps. Some of these are taken from GitHub for Windows.
F1to refresh. Could have different meaning on different views.~to launch a shell from any view. But not when Text input has focus.- Arrow keys: Navigate current focused list. Navigate to next list.
EscandALT+LeftArrowcloses current modal or popup screen.Enternavigates to current selected repository.
-
Key bound to a command: This is straightforward. You want a specific key combination to be bound to a specific
ICommandinstance. -
Key bound to a navigation command: In GitHub for Windows, we have the concept that
EscandALT+Backwill navigate back from whatever view you happen to be looking at. This applies to Menus and Modal views. Ideally, we wouldn't have to bind this to ever view's back command but have a way to have commands of a certain "class" respond to this key combination. -
Shortcut Popover: We'd like the "?" to launch a popover sheet that's automatically generated for the current view.
-
Global Shortcuts: We have
~mapped to launch a command shell no matter where you are. This could simply be a command on theMainWindowViewModel(orShellViewModeldepending on what you call it). But it also has to be smart to ignore cases when~is typed within a text input.