Adding custom hot keys
Adding custom hot keys, or keyboard shortcuts, increases productivity by helping users to perform common tasks quickly and efficiently. You can also create custom hot keys to focus on important fields or selections and reduce the number of clicks that a user needs to take to perform actions.
About this task
Note: You can add custom hot keys for any Order Hub screen except the ones that are
within buc-app-sfo.
You add custom keyboard shortcuts, or hot keys to your application by using the keybinding
system. The keybinding system consists of two main components:
- Hot key definitions, which define the keyboard shortcuts and their behavior.
- Translation keys, which provide descriptions for the shortcuts.
Procedure
What to do next
- Build the application to help ensure that no syntax errors exist.
- Go to the page where the hot keys are defined.
- Press the keyboard combination to test the functions.
- Verify that the action occurs as expected.
- Troubleshooting help for when a hot key is not working
-
- Verify that the element identifier targets the correct element.
- Make sure that the element identifier is a valid CSS selector. If the element identifier includes spaces, either include a backslash before the space (for example input#field\ Name), or rewrite the element identifier without spaces.
- Check that the element is visible and enabled.
- Make sure that the keybinding system hot key definition does not conflict with any browser shortcut.
- Confirm that the page name matches in initializeHotKeyListener().
- If the target element is not normally interactive (for example, a <div>), you must make it focusable by adding a tabIndex attribute before a hot key can trigger it.
- Troubleshooting help for when the translation is not showing
-
- Verify that the translation key path matches exactly.
- Check that KEY_BINDINGS is in the correct parent object.
- Make sure that the en.json file is a valid JSON file.
- Troubleshooting help for when the element is not found
-
- Use browser Dev Tools to verify the CSS selector.
- Check to make sure that the element is rendered conditionally.
- Make sure that the selector is specific.