@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
29 lines • 1.38 kB
TypeScript
import React from 'react';
/**
* "Trap" or "loop" focus within a provided `stackRef` element. This is required for accessibility
* on modals. If a keyboard users hits the Tab or Shift + Tab, this will force "looping" of focus.
* It effectively "hides" outside content from keyboard users. Use an overlay to hide content from
* mouse users and `useAssistiveHideSiblings` to hide content from assistive technology users. Works
* well with `useInitialFocus` and `useReturnFocus`.
*
* This should be used on popup elements that need to hide content (i.e. Modals).
*/
export declare const useFocusTrap: import("@workday/canvas-kit-react/common").BehaviorHook<{
state: {
stackRef: React.RefObject<HTMLDivElement>;
targetRef: React.RefObject<HTMLButtonElement>;
initialFocusRef: React.RefObject<any> | undefined;
returnFocusRef: React.RefObject<any> | undefined;
placement: import("@popperjs/core").Placement;
id: string;
visibility: "hidden" | "visible";
};
events: {
updatePlacement(data: {
placement: import("@popperjs/core").Placement;
}): void;
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
};
}, {}>;
//# sourceMappingURL=useFocusTrap.d.ts.map