@octopusdeploy/design-system-components
Version:
The design systems component library.
8 lines (7 loc) • 512 B
TypeScript
/**
* Traps focus within a DOM node. Shifting focus with `Tab` and `Shift-Tab` will loop through all focusable elements of the node.
* Nesting is handled naturally by the browser's event model — keydown events only bubble through DOM ancestors,
* so a trap only fires when focus is actually inside its container.
*/
export declare function useFocusTrap(focusContainer: HTMLElement | null, enabled?: boolean): void;
export declare function useFocusFirstFocusableElement(): (container: HTMLElement) => void;