@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
43 lines (42 loc) • 1.85 kB
TypeScript
export declare const getFocusableDescendants: (element: HTMLElement) => HTMLElement[] | boolean;
/**
* Retrieves an array of focusable descendants within a given element.
*
* @param element - The element to search for focusable descendants.
* @param elementsToOmit - Optional array of elements to omit from the search.
* @returns An array of HTMLElements representing the focusable descendants.
*/
export declare const getFocusableDescendantsV2: ({ element, elementsToOmit, }: {
element: HTMLElement;
elementsToOmit?: HTMLElement[];
}) => HTMLElement[];
/**
* Find the next focusable element (without looking to children)
* Return true when a focusable element has been found and focused
* @param element
* @returns boolean
*/
export declare const focusNextFocusableElement: (element: HTMLElement) => boolean;
/**
* Find the previous focusable element (without looking to children)
* Return true when a focusable element has been found and focused
* @param element
* @returns boolean
*/
export declare const focusPreviousFocusableElement: (element: HTMLElement) => boolean;
export declare const focusElementOrFirstDescendant: (element: HTMLElement) => void;
export declare const focusLastDescendantOrElement: (element: HTMLElement) => void;
export declare const focusFirstDescendant: (element: HTMLElement) => void;
/**
* Sets focus on the first focusable descendant of the given element.
*
* @param {Object} options - The options for focusing the first descendant.
* @param {HTMLElement} options.element - The element on which to set focus.
* @param {HTMLElement[]} [options.elementsToOmit] - An optional array of elements to omit from focus.
*
* @returns {void}
*/
export declare const focusFirstDescendantV2: ({ element, elementsToOmit, }: {
element: HTMLElement;
elementsToOmit?: HTMLElement[];
}) => void;