@momentum-ui/react-collaboration
Version:
Cisco Momentum UI Framework for React Collaboration Applications
33 lines (32 loc) • 1.24 kB
TypeScript
export declare const PRESERVE_TABINDEX_CLASSNAME = "md-nav-preserve-tabindex";
type Options = {
/**
* whether only tabbable children should be returned or all
*/
includeTabbableOnly?: boolean;
/**
* Exclude elements with `data-preserve-tabindex` attribute and all their children
*/
excludePreserveTabindex?: boolean;
};
/**
* Returns all focusable child elements as an Element Array
*
* An element focusable if it:
* - it is interactive element (anchor with href, button, input, textarea, select and details)
* - it is not disabled
* - it is not hidden
* - it or any of its parents do not have `aria-hidden=true` attribute
* - it or any of its parents do not have `data-preserve-tabindex` attribute or `
* md-nav-preserve-tabindex` class
* - it has none empty or not "-1" tabindex, see `includeTabbableOnly` parameter
*
* @remarks
* Element with 0 tabindex can be tabbed to, while elements with any tabindex value can be
* manually focused
*
* @param root Element lookup starts from this element
* @param options Options to customize the behavior
*/
export declare function getKeyboardFocusableElements<T extends HTMLElement>(root: T, options?: Options): Array<HTMLElement>;
export {};