UNPKG

@material-git/all

Version:
32 lines (31 loc) 1.41 kB
/** * Utility for checking the interactivity of an element, such as whether is is focusable or * tabbable. * * NOTE: Currently does not capture any special element behaviors, browser quirks, or edge cases. * This is a basic/naive starting point onto which further behavior will be added. * * This class uses instance methods instead of static functions so that alternate implementations * can be injected. * * TODO(jelbourn): explore using ally.js directly for its significantly more robust * checks (need to evaluate payload size, performance, and compatibility with tree-shaking). */ export declare class InteractivityChecker { /** Gets whether an element is disabled. */ isDisabled(element: HTMLElement): boolean; /** * Gets whether an element is visible for the purposes of interactivity. * * This will capture states like `display: none` and `visibility: hidden`, but not things like * being clipped by an `overflow: hidden` parent or being outside the viewport. */ isVisible(element: HTMLElement): boolean; /** * Gets whether an element can be reached via Tab key. * Assumes that the element has already been checked with isFocusable. */ isTabbable(element: HTMLElement): boolean; /** Gets whether an element can be focused by the user. */ isFocusable(element: HTMLElement): boolean; }