@hypothesis/frontend-shared
Version:
Shared components, styles and utilities for Hypothesis projects
13 lines (12 loc) • 520 B
TypeScript
import type { RefObject } from 'preact';
type UseFocusAwayOptions = {
/** Enable listening for focusout events in `container`? */
enabled?: boolean;
};
/**
* Listen on container for focusout events. If a focusout event's relatedTarget
* is outside of the `container` element, invoke the `callback`.
* Do not listen if not `enabled`.
*/
export declare function useFocusAway(container: RefObject<HTMLElement | undefined>, callback: (e: FocusEvent) => void, { enabled }?: UseFocusAwayOptions): void;
export {};