import { ReactWrapper } from "enzyme"; export declare const enzymeQuerySelectorWrapper: (wrapper: ReactWrapper, querySelectorStr: string, element?: HTMLElement | undefined) => Element | null; /** * Makes onClick functions accessible by duplicating them in an onKeyDown prop. If you also * have an onKeyDown function you'd like to provide, you can add it as an optional second argument. * * Why does it make it more accessible? The `onClick` prop usually only fires if someone * clicks an element with a mouse. If a user can't use a mouse due to a disability, they * are unable to activate the element. Normally, you'd have to wire up the element to receive * tab focus (using `tabIndex={0}`), as well as duplicating the onClick function for Enter * and Spacebar key presses. This function does that for you. * * Note that this is not necessary for buttons or anchor tags. * * Note that this returns `tabIndex={0}`. If you want to set a custom tabIndex value, apply it * after invoking this function. See example. * * Examples: * ```jsx *
Click me!
* * { * // do something * })}> * *
setState(true), * (e) => { * if(e.key === "ArrowRight"){ moveRight(); * } * } * )} * * // If you want to set a custom tabIndex value, set it *after* spreading the onClickA11y values. * // This will let you overwrite the tabIndex value. * tabIndex={focused ? 0 : 1} * >Label
* ``` * * @param onClickFn The function that normally goes in the `onClick={}` prop * @param onKeyDown The function that normally goes in the `onKeyDown={}` prop * @returns */ export declare const onClickA11y: (onClickFn: (e: React.KeyboardEvent | React.MouseEvent) => void, onKeyDown?: (e: React.KeyboardEvent) => void) => { tabIndex: number; onClick: (e: React.KeyboardEvent | React.MouseEvent) => void; onKeyDown: (e: React.KeyboardEvent) => void; }; //# sourceMappingURL=utils.d.ts.map