react-chrono
Version:
A Modern Timeline component for React
34 lines • 1.36 kB
TypeScript
interface UseFocusManagerProps {
shouldFocus: boolean;
isActive: boolean;
preventScroll?: boolean;
restoreFocus?: boolean;
}
/**
* Hook for managing focus with proper restoration and accessibility
*/
export declare const useFocusManager: ({ shouldFocus, isActive, preventScroll, restoreFocus, }: UseFocusManagerProps) => import('react').RefObject<HTMLDivElement | null>;
export interface UseFocusTrapOptions {
/** Whether the focus trap is active */
isActive: boolean;
/** Initial focus target: 'first', 'last', or specific element ref */
initialFocus?: 'first' | 'last' | React.RefObject<HTMLElement>;
/** Whether to restore focus when trap is deactivated */
returnFocus?: boolean;
/** Callback when user tries to escape trap (e.g., Tab from last element) */
onEscapeAttempt?: () => void;
}
/**
* Hook for managing focus trap within a container
*
* Enhanced version with support for:
* - Initial focus management
* - Focus restoration on unmount
* - Dynamic content updates (via MutationObserver)
* - Escape attempt callbacks
*
* @param options - Configuration options or boolean for backward compatibility
*/
export declare const useFocusTrap: (options: boolean | UseFocusTrapOptions) => import('react').RefObject<HTMLDivElement | null>;
export {};
//# sourceMappingURL=useFocusManager.d.ts.map