Constructor
new OO.ui.mixin.TabIndexedElement([config])abstract
#
The TabIndexedElement class is an attribute mixin used to add additional functionality to an element created by another class. The mixin provides a ‘tabIndex’ property, which specifies the order in which users will navigate through the focusable elements via the Tab key.
Example
// TabIndexedElement is mixed into the ButtonWidget class
// to provide a tabIndex property.
const button1 = new OO.ui.ButtonWidget( {
label: 'fourth',
tabIndex: 4
} ),
button2 = new OO.ui.ButtonWidget( {
label: 'second',
tabIndex: 2
} ),
button3 = new OO.ui.ButtonWidget( {
label: 'third',
tabIndex: 3
} ),
button4 = new OO.ui.ButtonWidget( {
label: 'first',
tabIndex: 1
} );
$( document.body ).append(
button1.$element,
button2.$element,
button3.$element,
button4.$element
);
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object |
optional |
Configuration options Properties:
|
- Source:
The TabIndexedElement class is an attribute mixin used to add additional functionality to an element created by another class.
Methods
blur() → {OO.ui.Element}chainable
#
focus() → {OO.ui.Element}chainable
#
getInputId() → {string|null
}
#
null
}
#
Get an ID of a focusable element of this widget, if any, to be used for <label for>
value.
If the element already has an ID then that is returned, otherwise unique ID is generated, set on the element, and returned.
- Source:
Returns:
The ID of the focusable element
- Type
-
string
|
null
<label for>
value.
getTabIndex() → {number|null
}
#
null
}
#
Get the value of the tabindex.
- Source:
Returns:
Tabindex value
- Type
-
number
|
null
setTabIndex(tabIndex) → {OO.ui.Element}chainable
#
Set the value of the tabindex.
Parameters:
Name | Type | Description |
---|---|---|
tabIndex |
string
|
number
|
null
|
Tabindex value, or |
- Source:
Returns:
The element, for chaining
- Type
- OO.ui.Element
setTabIndexedElement($tabIndexed) → {OO.ui.Element}chainable
#
Set the element that should use the tabindex functionality.
This method is used to retarget a tabindex mixin so that its functionality applies to the specified element. If an element is currently using the functionality, the mixin’s effect on that element is removed before the new element is set up.
Parameters:
Name | Type | Description |
---|---|---|
$tabIndexed |
jQuery | Element that should use the tabindex functionality |
- Source:
Returns:
The element, for chaining
- Type
- OO.ui.Element
simulateLabelClick()
#
- Source: