Skip to end of metadata
Go to start of metadata

Available:

JIRA 4.1 and later

Changed:

In JIRA 4.2 and later, the keyboard-shortcut element accepts an optional child element (hidden), which prevents the keyboard shortcut from appearing on the keyboard shortcuts dialog box. Existing keyboard shortcuts can also be overridden.

Purpose of this Module Type

A keyboard shortcut plugin module defines a keyboard shortcut within JIRA. A JIRA keyboard shortcut allows you to perform potentially any action in JIRA using one or more keyboard strokes - for example, going to the Dashboard, browsing a project, moving your cursor to a field on a JIRA form, or creating, editing or commenting on an issue.

Configuration

The root element for the keyboard shortcut plugin module is keyboard-shortcut. It allows the following attributes and child elements for configuration:

Attributes

Name

Required

Description

Default

key

(tick)

The unique identifier of the plugin module. You refer to this key to use the resource from other contexts in your plugin, such as from the plugin Java code or JavaScript resources.

<component-import key="appProps" interface="com.atlassian.sal.api.ApplicationProperties"/>

In the example, appProps is the key for this particular module declaration, for component-import, in this case.

N/A

i18n-name-key

 

The localisation key for the human-readable name of the plugin module.

 

name

 

The human-readable name of the plugin module.

The plugin key.

hidden

 

When hidden='true', the keyboard shortcut will not appear in the Keyboard Shortcuts dialog box.
(info) Despite not appearing in the dialog box, hidden keyboard shortcuts can still be accessed via they keystrokes.
(info) This attribute is only available in JIRA 4.2 and later.

false

Elements

Name

Required

Description

order

(tick)

A value that determines the order in which the shortcut appears on the Keyboard Shortcuts dialog box (with respect to other keyboard-shortcut plugin modules). This element is also used to override existing shortcuts displayed on the Keyboard Shortcuts dialog box (see below).
(info) For each keyboard-shortcut plugin module, we recommend using gaps in order values (for example, 10, 20, 30, etc.) rather than consecutive values. This will allow you to 'insert' new keyboard shortcuts more easily into the keyboard shortcuts dialog box.

description

(tick)

A human-readable description of this keyboard shortcut module. May be specified as the value of this element for plain text or with the key attribute to use the value of a key from the i18n system.

shortcut

(tick)

The sequence of keystrokes required to activate the keyboard shortcut's operation. These should be presented in the order that the keys are pressed on a keyboard. For example, gb represents a keyboard shortcut whose operation is activated after pressing 'g', followed by 'b' on the keyboard.

operation

(tick)

A jQuery selector that specifies the target of the keyboard shortcut. The target is typically a component of the current page that performs an action. The operation element is accompanied by a type attribute that specifies the type of keyboard shortcut operation. For more information on the available types, please refer to the JIRA API documentation.

context

 

The section of the Keyboard Shortcuts dialog box on which the shortcut appears and defines where the keyboard shortcut can be used in JIRA. If this element contains:

  • global (or is omitted) — the keyboard shortcut appears in the 'Global Shortcuts' section of this dialog box.
  • issueaction — the keyboard shortcut appears in the 'Issue Actions' section of the dialog box.
  • issuenavigation — the keyboard shortcut appears in the 'Navigating Issues' section of the dialog box.

Overriding Existing Keyboard Shortcuts

(info) This feature is only available in JIRA 4.2 and later.

You can override an existing keyboard shortcut defined either within JIRA itself or in another plugin.

To do this create a keyboard-shortcut plugin module with exactly the same shortcut element's keystroke sequence as that of the keyboard shortcut you want to override. Then, ensure that an order element is added, whose value is greater than that defined in the keyboard shortcut being overridden.

(info) While the order element may affect the position of your overriding keyboard shortcut on the Keyboard Shortcuts dialog box, it will also prevent the overridden keyboard shortcut from:

  • being accessed via the keyboard and
  • appearing in the dialog box, on the proviso that you are overriding the keyboard shortcut within the same 'context' (i.e. with the same context element above).

Internationalisation

It is possible to include an i18n resource in your atlassian-plugin.xml to translate keyboard shortcut descriptions (via their 'key' attributes) into multiple languages. For examples code on including i18n resources in your atlassian-plugin.xml file, please refer to Downloadable Plugin Resources.

Examples

These examples are taken from JIRA's pre-defined keyboard shortcuts for going to the Dashboard, commenting on an issue and moving to the next action item on an issue view.

  • No labels

4 Comments

  1. How do I use space or return as a shortcut?

    1. Hello Matt,

      Keys such as a space or return/enter key are currently not supported by this plugin module.

      One of the main reasons for this is that these keys are often used to select (i.e. left-mouse-button click) items on a page which have the current focus. Hence, using an additional return key shortcut might lead to potential usability confusion. For example, a return key might perform a specific action when a particular item on a page has the focus. However, if no items have the focus on that page, the return key could perform a completely different action.

      Cheers,
      Giles.

  2. What happens if a jQuery selector doesn't match anything on the page? Is that acceptable? I'm trying to create a shortcut that is only valid in the context of a single page.

    1. As far as I'm aware, if a jQuery selector doesn't match anything on a page, then a keyboard shortcut using this specific selector will do nothing when it is used on that page.

      I believe this will be acceptable for what you are trying to achieve, but please let me know if otherwise or you require any further information.

      Cheers,
      Giles.