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

Function onKeyDown

packages/react-aria/src/tooltip/useTooltipTrigger.ts:63–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61
62 useEffect(() => {
63 let onKeyDown = e => {
64 if (ref && ref.current) {
65 // Escape after clicking something can give it keyboard focus
66 // dismiss tooltip on esc key press
67 if (e.key === 'Escape') {
68 e.stopPropagation();
69 state.close(true);
70 }
71 }
72 };
73 if (state.isOpen) {
74 document.addEventListener('keydown', onKeyDown, true);
75 return () => {

Callers

nothing calls this directly

Calls 1

closeMethod · 0.65

Tested by

no test coverage detected