Manual:Access keys

Access keys or keyboard shortcuts are defined for many actions in MediaWiki. This page documents all access keys in use, and details the ways in which developers can add them to MediaWiki core and extensions. End user help is at.

Access keys are invoked with different modifier keys on different operating systems and web browsers. The Access key page lists all combinations. MediaWiki will add tooltips where it can to help users discover what access keys are available for a given action (including platform-specific modifiers).

Defining an access key
Defining an access key is usually done via the accesskey="" HTML attribute, and in some cases (e.g. in VisualEditor) is done with custom keypress handling.

The key used should not be hard-coded, but should be added as a. The message should start with  and its message documentation in   should include the   template from Translatewiki.net. Acccess key messages should also be listed in TranslateWiki's file (for example, ).

All access keys should be recorded on this page (see below), to make it easier for developers to choose new available access keys.

JavaScript
To create a button with an access key the following code could be used:

var myButton = new OO.ui.ButtonWidget( {	label: mw.msg( 'myext-myaction' ),	accessKey: mw.msg( 'accesskey-myext-myaction' ),	title: mw.msg( 'myext-myaction-title' ) } );

Note that when using OOUI, it's worth adding a title to any AccessKeyedElement because this results in the access key be appended to the title/tooltip and so is more discoverable by users.

PHP
The  method should be used when constructing links with access keys. For example:

This will result in the following HTML:

In JavaScript-enabled browsers, the  will be dynamically updated (to e.g.  ) by updateTooltipAccessKeys to include the correct modifier keys depending on the user's browser and operating system.