@altimex-ui/focus-lock
Version:
Focus lock utils for all the components
49 lines • 1.58 kB
TypeScript
import * as React from "react";
import { FocusableElement } from "@altimex-ui/react-utils";
export interface FocusLockProps {
/**
* `ref` of the element to receive focus initially
*/
initialFocusRef?: React.RefObject<FocusableElement>;
/**
* `ref` of the element to return focus to when `FocusLock`
* unmounts
*/
finalFocusRef?: React.RefObject<FocusableElement>;
/**
* The `ref` of the wrapper for which the focus-lock wraps
*/
contentRef?: React.RefObject<HTMLElement>;
/**
* If `true`, focus will be restored to the element that
* triggered the `FocusLock` once it unmounts
*/
restoreFocus?: boolean;
/**
* The component to render
*/
children: React.ReactNode;
/**
* If `true`, focus trapping will be disabled
*/
isDisabled?: boolean;
/**
* If `true`, the first focuable element within the `children`
* will ne auto-focused once `FocusLock` mounts
*/
autoFocus?: boolean;
/**
* If `true`, disables text selections inside, and outside focus lock.
* @default `false`
*/
persistentFocus?: boolean;
/**
* Enables aggressive focus capturing within iframes.
* - If `true`: keep focus in the lock, no matter where lock is active
* - If `false`: allows focus to move outside of iframe
*/
lockFocusAcrossFrames?: boolean;
}
export declare const FocusLock: React.FC<FocusLockProps>;
export default FocusLock;
//# sourceMappingURL=index.d.ts.map