Expand all

abstract OO.ui.mixin.AccessKeyedElement

Constructor

new OO.ui.mixin.AccessKeyedElement([config])abstract #

AccessKeyedElement is mixed into other classes to provide an accesskey HTML attribute. Access keys allow an user to go to a specific element by using a shortcut combination of a browser specific keys + the key set to the field.

Example

// AccessKeyedElement provides an `accesskey` attribute to the
    // ButtonWidget class.
    const button = new OO.ui.ButtonWidget( {
        label: 'Button with access key',
        accessKey: 'k'
    } );
    $( document.body ).append( button.$element );

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Default Description
$accessKeyed jQuery optional

The element to which the accesskey attribute is applied. If this config is omitted, the access key functionality is applied to $element, the element created by the class.

accessKey string | function | null optional
null

The key or a function that returns the key. If this config is omitted, no access key will be added.

Source:
AccessKeyedElement is mixed into other classes to provide an accesskey HTML attribute.

Properties

accessKeystatic #

The access key, a function that returns a key, or null for no access key.

Properties:

Type Description
string | function | null
Source:
The access key, a function that returns a key, or null for no access key.

Methods

formatTitleWithAccessKey(title) → {string} #

Add information about the access key to the element's tooltip label. (This is only public for hacky usage in FieldLayout.)

Parameters:

Name Type Description
title string

Tooltip label for title attribute

Source:

Returns:

Type
string
Add information about the access key to the element's tooltip label.

getAccessKey() → {string} #

Get access key.

Source:

Returns:

accessKey string

Type
string
Get access key.

setAccessKey(accessKey) → {OO.ui.Element}chainable #

Set access key.

Parameters:

Name Type Description
accessKey string | function | null

Key, a function that returns a key, or null for no access key

Source:

Returns:

The element, for chaining

Type
OO.ui.Element
Set access key.

setAccessKeyedElement($accessKeyed) #

Set the access keyed element.

This method is used to retarget a AccessKeyedElement mixin so that its functionality applies to the specified element. If an element is already set, the mixin's effect on that element is removed before the new element is set up.

Parameters:

Name Type Description
$accessKeyed jQuery

Element that should use the 'access keyed' functionality

Source:
Set the access keyed element.