Add a component for showing keyboard shortcuts.

Review Request #13600 — Created March 2, 2024 and submitted — Latest diff uploaded

Information

Ink
master

Reviewers

This introduces Ink.KeyboardShortcut, a utility component used to
display an available keyboard shortcut and optionally register it.

Keys are shown in a form that best matches the local operating system.
On macOS, the Control, Meta/Cmd, Alt/Option, and Shift keys show the
typical symbols, for instance. Some symbols are used in all cases, such
as arrows.

If a KeyboardShortcut is instantiated with an onInvoke and
registry options, then the keyboard shortcut will be registered in the
registry and the onInvoke handler will be called when the shortcut is
pressed. A special onInvoke value of click will trigger a click
event on this component, bubbling up to a parent, which will be useful
for buttons and menu items.

Unit tests pass.

Tested this with in-progress components, ensuring that registration
and event handling worked correctly.


Commits

Files

    Loading...