FocusManager

Monster.DOM. FocusManager

With this function you can read the language version set by the document. For this the attribute lang in the html tag is read. If no attribute is set, en is used as default.

You can create the class via the monster namespace new Monster.DOM.FocusManager().

<script type="module">
import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.25.0/dist/modules/dom/focusmanager.js';
new Monster.DOM.FocusManager()
</script>

Alternatively, you can also integrate this function individually.

<script type="module">
import {FocusManager} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.25.0/dist/modules/dom/focusmanager.js';
new FocusManager()
</script>

Constructor

# new FocusManager(options)

Manage the focus

Parameters:
Name Type Description
options Object | undefined
Since:
  • 1.25.0
Throws:

unsupported locale

Type
Error

Members

# defaults

Properties
Name Type Description
document HTMLDocument

the document object into which the node is to be appended

Methods

# focus(element, preventScroll) → {Monster.DOM.FocusManager}

Parameters:
Name Type Description
element Node
preventScroll boolean
Throws:

value is not an instance of

Type
TypeError
Returns:
Type
Monster.DOM.FocusManager

# focusNext(query) → {Monster.DOM.FocusManager}

Parameters:
Name Type Description
query string
Returns:
Type
Monster.DOM.FocusManager

# focusPrev(query) → {Monster.DOM.FocusManager}

Parameters:
Name Type Description
query string
Returns:
Type
Monster.DOM.FocusManager

# getActive() → {Element}

Returns:
Type
Element

# getFocusable(query) → {array}

Select all elements that can be focused

Parameters:
Name Type Description
query string | undefined
Throws:

value is not an instance of

Type
TypeError
Returns:
Type
array

# restoreFocus() → {Monster.DOM.FocusManager}

The last focus on the stack is set again

Returns:
Type
Monster.DOM.FocusManager

# storeFocus() → {Monster.DOM.FocusManager}

Remembers the current focus on a stack. Several focus can be stored.

Returns:
Type
Monster.DOM.FocusManager