(event: globalThis.KeyboardEvent)
| 3687 | */ |
| 3688 | useEffect(() => { |
| 3689 | const onKeyDown = (event: globalThis.KeyboardEvent): void => { |
| 3690 | const target = event.target as Element | null; |
| 3691 | const shortcut = menuShortcutFor(event, target, WIRED_MENU_SHORTCUTS); |
| 3692 | if (shortcut !== undefined) { |
| 3693 | const act = menuActionsRef.current[shortcut]; |
| 3694 | if (act !== undefined) { |
| 3695 | event.preventDefault(); |
| 3696 | markHandled(event, shortcut); |
| 3697 | act(); |
| 3698 | } |
| 3699 | return; |
| 3700 | } |
| 3701 | const guard = keyboardGuardRef.current; |
| 3702 | if (guard.overlayOpen) { |
| 3703 | return; |
| 3704 | } |
| 3705 | if (guard.walkRunning && playerIntent(event.key) !== 'none') { |
| 3706 | return; |
| 3707 | } |
| 3708 | }; |
| 3709 | window.addEventListener('keydown', onKeyDown, KEY_LISTENER_OPTIONS); |
| 3710 | return () => window.removeEventListener('keydown', onKeyDown, KEY_LISTENER_OPTIONS); |
| 3711 | }, []); |
nothing calls this directly
no test coverage detected