UNPKG

@theia/core

Version:

Theia is a cloud & desktop IDE framework implemented in TypeScript.

17 lines 810 B
/** * Query whether the keyboard event represents an element activation. * That is, whether the user pressed `Enter` or `Space` on a focusable * element with `role="button"` or similar interactive role. */ export declare function isActivationKey(e: React.KeyboardEvent | KeyboardEvent): boolean; /** * Returns the ARIA/accessibility props that make a non-button HTML element * keyboard-navigable and screen-reader-accessible as a button. * * Spread these onto the element alongside `onClick` and `onKeyDown`: * ```tsx * <div {...buttonKeyboardProps(label)} onClick={handler} onKeyDown={e => isActivationKey(e) && handler()} /> * ``` */ export declare function buttonKeyboardProps(ariaLabel: string, tabIndex?: number): React.HTMLAttributes<HTMLElement>; //# sourceMappingURL=keyboard-utils.d.ts.map