interface KeyboardHandlerProps {
    additionalKeyHandler?: ((event: KeyboardEvent) => void);
    containerRef: RefObject<any>;
    createNavigableElements: (() => Element[]);
    getFocusableElement?: ((navigableElement: Element) => Element);
    isActiveElement?: ((navigableElement: Element) => boolean);
    isEventFromContainer?: ((event: KeyboardEvent) => boolean);
    noEnterHandling?: boolean;
    noHorizontalArrowHandling?: boolean;
    noSpaceHandling?: boolean;
    noVerticalArrowHandling?: boolean;
    onlyTraverseSiblings?: boolean;
    updateTabIndex?: boolean;
    validSiblingTags?: string[];
}

Properties

additionalKeyHandler?: ((event: KeyboardEvent) => void)

Additional key handling outside of the included arrow keys, enter, and space handling

containerRef: RefObject<any>

Reference of the container to apply keyboard interaction

createNavigableElements: (() => Element[])

Callback returning an array of navigable elements to be traversable via vertical arrow keys. This array should not include non-navigable elements such as disabled elements.

getFocusableElement?: ((navigableElement: Element) => Element)

Callback returning the focusable element of a given element from the navigable elements array

isActiveElement?: ((navigableElement: Element) => boolean)

Callback to determine if a given element from the navigable elements array is the active element of the page

isEventFromContainer?: ((event: KeyboardEvent) => boolean)

Callback to determine if a given event is from the container. By default the function conducts a basic check to see if the containerRef contains the event target

noEnterHandling?: boolean

Flag indicating that the included enter key handling should be ignored

noHorizontalArrowHandling?: boolean

Flag indicating that the included horizontal arrow key handling should be ignored

noSpaceHandling?: boolean

Flag indicating that the included space key handling should be ignored

noVerticalArrowHandling?: boolean

Flag indicating that the included vertical arrow key handling should be ignored

onlyTraverseSiblings?: boolean

Flag indicating that next focusable element of a horizontal movement will be this element's sibling

updateTabIndex?: boolean

Flag indicating that the tabIndex of the currently focused element and next focused element should be updated, in the case of using a roving tabIndex

validSiblingTags?: string[]

Valid sibling tags that horizontal arrow handling will focus