UNPKG

1.79 kBTypeScriptView Raw
1import { VisibilityCache } from './is';
2import { NodeIndex } from './tabOrder';
3/**
4 * given list of focusable elements keeps the ones user can interact with
5 * @param nodes
6 * @param visibilityCache
7 */
8export declare const filterFocusable: (nodes: HTMLElement[], visibilityCache: VisibilityCache) => HTMLElement[];
9export declare const filterAutoFocusable: (nodes: HTMLElement[], cache?: VisibilityCache) => HTMLElement[];
10/**
11 * !__WARNING__! Low level API.
12 * @returns all tabbable nodes
13 *
14 * @see {@link getFocusableNodes} to get any focusable element
15 *
16 * @param topNodes - array of top level HTMLElements to search inside
17 * @param visibilityCache - an cache to store intermediate measurements. Expected to be a fresh `new Map` on every call
18 */
19export declare const getTabbableNodes: (topNodes: Element[], visibilityCache: VisibilityCache, withGuards?: boolean | undefined) => NodeIndex[];
20/**
21 * !__WARNING__! Low level API.
22 *
23 * @returns anything "focusable", not only tabbable. The difference is in `tabIndex=-1`
24 * (without guards, as long as they are not expected to be ever focused)
25 *
26 * @see {@link getTabbableNodes} to get only tabble nodes element
27 *
28 * @param topNodes - array of top level HTMLElements to search inside
29 * @param visibilityCache - an cache to store intermediate measurements. Expected to be a fresh `new Map` on every call
30 */
31export declare const getFocusableNodes: (topNodes: Element[], visibilityCache: VisibilityCache) => NodeIndex[];
32/**
33 * return list of nodes which are expected to be auto-focused
34 * @param topNode
35 * @param visibilityCache
36 */
37export declare const parentAutofocusables: (topNode: Element, visibilityCache: VisibilityCache) => Element[];
38export declare const contains: (scope: Element | ShadowRoot, element: Element) => boolean;