UNPKG

@blueprintjs/select

Version:

Components related to selecting items from a list

22 lines (21 loc) 1.25 kB
/** `KeyboardEvent.key` value for the spacebar. */ export declare const SPACE_KEY = " "; /** * Returns whether the focused target of an Enter/Space key event will fire its own click on keyup. * * Such targets activate the popover themselves, so a Select/MultiSelect wrapper must NOT also open on * keydown — doing so opens the popover early and then the target's synthesized keyup click toggles it * back closed. Targets that do not self-activate (a plain `role="button"` element, a bare anchor) get no * such click, so the wrapper is responsible for opening the popover itself. * * Self-activating targets: * - native `<button>` (fires click on Enter and on Space keyup) * - Blueprint `<Button>`/`<AnchorButton>`, detected via {@link Classes.BUTTON}, which synthesize a click * on keyup for both keys regardless of tag or `href` * - native `<a href>` (fires click on Enter only) * * The search is scoped to the handler's own element (`currentTarget`) so a clickable ancestor rendered * outside the target cannot suppress activation, and a disabled activator is treated as non-activating * because it never fires its own click. */ export declare function targetSelfActivatesOnKeyUp(event: React.KeyboardEvent<HTMLElement>): boolean;