Keyboard keystrokes

The uicontrol element should be used when describing keys on a keyboard, and the userinput element for describing a series of keystrokes that the user must input. The name of the key should not be encapsulated or bracketed.

It is not immediately obvious in DITA which element should be used to mark up keyboard keys, such as Enter, Ctrl and Backspace. The best approach (without resorting to specialisation) is to use the uicontrol and userinput elements, depending on context.

When describing keys on a computer keyboard, use the uicontrol element. For example, <p>Use the <uicontrol>Tab<uicontrol> to move from field to field.</p>.

Note: Do not use the shortcut element; this element is for identifying keyboard shortcuts in descriptions of user interface controls in windowed applications.

When describing a series of keystrokes, or data, that the user must input, use the userinput element. For example, <cmd>Enter <userinput>1234</userinput>, then <uicontrol>Tab</uicontrol> to continue.</cmd>.

Do not bracket the key name, such as by using square brackets around Tab to form <uicontrol>[Tab]</uicontrol>.

If the keyboard keys or keystrokes need to be rendered differently from other user interface controls (such as fields and buttons) in the output, then a specialisation should be created. An alternative is to use a consistent outputclass attribute on the keyboard elements.