Keyboard Shortcut

This module type adds the ability for an add-on to declare keyboard shortcuts. Currently only available for Jira.

A Connect keyboard shortcut can perform one of three actions: navigate to a page, open a dialog module, or invoke an action represented by a web-item on a page. Pages, dialog modules and web-items referenced by the shortcut must be declared by the same add-on.

A shortcut is identified by a sequence of letters which need to be pressed in order for the shortcut action to be invoked. You cannot declare shortcuts that would shadow shortcuts defined by the product. A shortcut shadows all shortcuts which start with its sequence.

On the other hand, it's possible to shadow shortcuts defined by the same or other add-ons, although those won't be accessible anymore.

In case multiple shortcuts have the same sequence, there is no guarantee on which will be invoked.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
  "modules": {
    "keyboardShortcuts": [
      {
        "shortcut": "gmm",
        "target": {
          "key": "page-key"
        },
        "context": "global",
        "name": {
          "value": "My keyboard shortcut"
        },
        "key": "keyboard-shortcut-key"
      }
    ]
  }
}

Properties

key
Type
Max length
100
Required
Yes
Pattern
^[a-zA-Z0-9-]+$
Description

A key to identify this module.

This key must be unique relative to the add on, with the exception of Confluence macros: Their keys need to be globally unique.

Keys must only contain alphanumeric characters and dashes.

The key is used to generate the url to your add-on's module. The url is generated as a combination of your add-on key and module key. For example, an add-on which looks like:

1
2
3
4
5
6
7
8
9
{
    "key": "my-addon",
    "modules": {
        "configurePage": {
            "key": "configure-me",
        }
    }
}

Will have a configuration page module with a URL of /plugins/servlet/ac/my-addon/configure-me.


name
Type
Required
Yes
Description

A human readable name.

Represents a string that can be resolved via a localization properties file. You can use the same i18n Property key and value in multiple places if you like, but identical keys must have identical values.

Example

1
2
3
4
{
  "value": "My text"
}

Properties

value
Type
Max length
1500
Required
Yes
Description

The human-readable default value. This will be used if no translation exists. Only the following HTML tags are supported: b, i, strong, em, and code.

i18n
Type
Max length
300
Description

The localization key for the human-readable value. Translations for the keys are defined at the top level of the add-on descriptor.


shortcut
Type
Max length
3
Required
Yes
Pattern
[a-z]{1,3}
Description

The shortcut sequence. The current limitations are

  • the sequence cannot shadow an existing product shortcut
  • can only contain lowercase letters
  • has to be shorter than 4 characters


target
Type
Required
Yes
Description

The target must be the key of another module defined by the add-on.

Below are the actions which will be executed by the shortcut depending on the module type of the target.

  • General Page: Navigates to the general page
  • Dialog: Opens the dialog
  • Web Item: Emulates clicking on the web item, which must be present on the current page

The bean containing the key of the target module of the shortcut.

Properties

key
Type
Max length
1000
Required
Yes
Pattern
^[a-zA-Z0-9-]+$
Description

The key of the target module, defined in the add-on descriptor.


context
Type
Allowed values
  • global
  • GLOBAL
  • issue_navigation
  • ISSUE_NAVIGATION
  • issue_action
  • ISSUE_ACTION
  • agile_board
  • AGILE_BOARD
Description

The context in which the shortcut will be available. This is optional, if not given the shortcut is assumed to be global. Different products define different contexts.

Jira supported contexts:

  • global
  • issue_navigation
  • issue_action
  • agile_board