A list of elements to manage focus for
Options to pass to the RovingFocus
Applies appropriate tabindex to all elements. Optionally focuses the active element.
If true, will immediately focus the active element
Removes tabindexes from all elements
Move focus to the first element
Move focus to a specific element by index
Optional
index: numberMove focus to the last element
Move focus to the next element
Move focus to the previous element
Implements a Roving Focus or Roving Tab Index pattern: https://developer.mozilla.org/en-US/docs/Web/Accessibility/Guides/Keyboard-navigable_JavaScript_widgets#technique_1_roving_tabindex
Ensures the only one of the provided elements can be tab-focused at any given time. The other elements will be deactivated from tabbing by setting tabindex="-1".
The focused element can be changed by calling the
focus()
method with the index of the element to focus, or by callingnext()
orprev()
to cycle.This is useful for implementing group-like patterns where only one element in a group should be focusable at a time.