shortcut

Overview

The shortcut component allows developers to register view-level keyboard shortcuts for specified actions.

Note: These shortcuts only persist while the user remains on the corresponding view. For use cases where shortcuts should persist across views, see the documentation for the ShortcutManager JS/TS API.

Version compatibility

  • shortcut was introduced in version 4.58.0 of the JourneyApps Runtime.

  • Keyboard shortcuts are only supported on Desktop.

Basic Example

main.view.xml
<shortcut keys="CTRL+I" name="Show dialog" action="$:showDialog()" />
main.js
function showDialog() {
    journey.dialog.simple({
        title: "Success"
    })
}

Reserved keys

The following keys are reserved and hence cannot be used as keys:

  • CTRL+Z

  • CTRL+SHIFT+Z

  • CTRL+Y

  • CTRL+C

  • CTRL+V

  • CTRL+R

  • ESC

  • ENTER

  • BACKSPACE

  • DELETE

OXIDE will show an error if a reserved key combination is used:

Standard Attributes

keys

Required

Type: string

Default: unset

Specify a key or key combination for the shortcut. Only one key or key combination is supported.

Example:

<shortcut keys="CTRL+I" action="$:showDialog()" />

action

Required

Type: JS/TS function

Default: unset

An event that calls a JS/TS $:function or navigation when a user presses the key or key combination specified in the keys attribute.

main.view.xml
<shortcut keys="CTRL+I" action="$:showDialog()" />
main.js
function showDialog() {
    journey.dialog.simple({
        title: "Success"
    })
}

Advanced Attributes

name

Optional

Type: string

Default: unset

A human readable name to identify or describe the shortcut.

Last updated