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

Function willOpenKeyboard

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

Source from the content-addressed store, hash-verified

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