MCPcopy Create free account
hub / github.com/adobe/react-spectrum / willOpenKeyboard

Function willOpenKeyboard

packages/react-aria/src/utils/keyboard.tsx:313–323  ·  view source on GitHub ↗
(target: Element | null)

Source from the content-addressed store, hash-verified

311}
312
313export function willOpenKeyboard(target: Element | null): boolean {
314 if (!(target instanceof Element) || !isFocusable(target)) {
315 return false;
316 }
317
318 let isTextArea = target instanceof HTMLTextAreaElement;
319 let isEditable = target instanceof HTMLElement && target.isContentEditable;
320 let isTextInput = target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type);
321
322 return isTextArea || isEditable || isTextInput;
323}
324
325export function isCtrlKeyPressed(event: KeyPressEvent): boolean {
326 return isMac() ? event.metaKey : event.ctrlKey;

Callers 7

keyboard.test.tsFile · 0.90
runAfterKeyboardFunction · 0.90
onBlurFunction · 0.90
onBlurFunction · 0.90
onResizeEndFunction · 0.85
onFocusFunction · 0.85

Calls 2

isFocusableFunction · 0.90
hasMethod · 0.65

Tested by

no test coverage detected