UNPKG

1.12 kBTypeScriptView Raw
1import * as React from 'react';
2/**
3 * Initializes the logic which:
4 *
5 * 1. Subscribes keydown and mousedown events. (It will only do it once per window,
6 * so it's safe to call this method multiple times.)
7 * 2. When the user presses directional keyboard keys, adds the 'ms-Fabric--isFocusVisible' classname
8 * to the document body, removes the 'ms-Fabric-isFocusHidden' classname.
9 * 3. When the user clicks a mouse button, adds the 'ms-Fabric-isFocusHidden' classname to the
10 * document body, removes the 'ms-Fabric--isFocusVisible' classname.
11 *
12 * This logic allows components on the page to conditionally render focus treatments based on
13 * the existence of global classnames, which simplifies logic overall.
14 *
15 * @param rootRef - A Ref object. Focus rectangle can be applied on itself and all its children.
16 */
17export declare function useFocusRects(rootRef?: React.RefObject<HTMLElement>): void;
18/**
19 * Function Component wrapper which enables calling `useFocusRects` hook.
20 * Renders nothing.
21 */
22export declare const FocusRects: React.FunctionComponent<{
23 rootRef?: React.RefObject<HTMLElement>;
24}>;