MCPcopy Index your code
hub / github.com/adobe/react-spectrum / handleKeyDown

Function handleKeyDown

packages/dev/s2-docs/src/SearchMenuTrigger.tsx:110–129  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

108 };
109
110 const handleKeyDown = (e: KeyboardEvent) => {
111 if (e.isComposing) {
112 // avoid intercepting IME input
113 return;
114 }
115
116 if (e.key === 'Escape' && isSearchOpen) {
117 e.preventDefault();
118 onClose();
119 } else if (e.key === 'k' && (isMac ? e.metaKey : e.ctrlKey)) {
120 e.preventDefault();
121 open('');
122 } else if (
123 e.key === '/' &&
124 !(isTextInputLike(e.target as Element | null) || isTextInputLike(getActiveElement()))
125 ) {
126 e.preventDefault();
127 open('');
128 }
129 };
130
131 let handleCustomEvent = () => {
132 open('');

Callers

nothing calls this directly

Calls 3

getActiveElementFunction · 0.90
isTextInputLikeFunction · 0.85
openFunction · 0.50

Tested by

no test coverage detected