Focus utility.
- Source:
Methods
(static) .focus(el)
Sets new focus.
Parameters:
Name | Type | Description |
---|---|---|
el |
node | the element to set focus on. |
- Source:
(static) .isFocusable(el) → {boolean}
Determines if an element is focusable.
An element is considered focusable if it is of a certain type or has appropriate tabIndex, is visible and not disabled.
Parameters:
Name | Type | Description |
---|---|---|
el |
node | the element to check focusability of. |
- Source:
Returns:
- true if focusable.
- Type
- boolean
(static) .listFocusableElements(contextopt) → {Array}
Lists all focusable elements within an element or the document.
This uses the same logic as isFocusable but also
excludes links within the closed meganav.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
context |
Node |
<optional> |
document | DOM element |
- Source:
Returns:
- an array of focusable nodes.
- Type
- Array
(static) .lost(identifier)
Reports lost focus.
Parameters:
Name | Type | Description |
---|---|---|
identifier |
string | an optional arbitrary identifier. |
- Source:
(static) .next(elopt, contextopt)
Moves focus to next focusable element.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
el |
node |
<optional> |
activeElement | the focusable element we want to set focus in relation to. |
context |
node |
<optional> |
document | DOM element |
- Source:
(static) .prev(elopt, contextopt)
Moves focus to previous focusable element.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
el |
node |
<optional> |
activeElement | the focusable element we want to set focus in relation to. |
context |
node |
<optional> |
document | DOM element |
- Source:
Events
.focusLost
- Source: