fix: allow typing in search box without WASD moving camera
Some checks are pending
Deploy to Production / deploy (push) Waiting to run
Test / backend-test (push) Waiting to run
Test / frontend-test (push) Waiting to run

This commit is contained in:
fullsizemalt 2025-12-18 11:44:51 -08:00
parent 8916acbe4b
commit 76c96728f3

View file

@ -45,6 +45,12 @@ export function FacilityScene({
useEffect(() => { useEffect(() => {
const handleDown = (e: KeyboardEvent) => { const handleDown = (e: KeyboardEvent) => {
// Don't capture keys when an input/textarea is focused
const activeEl = document.activeElement;
if (activeEl && (activeEl.tagName === 'INPUT' || activeEl.tagName === 'TEXTAREA')) {
return;
}
if (['KeyW', 'KeyA', 'KeyS', 'KeyD', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(e.code)) { if (['KeyW', 'KeyA', 'KeyS', 'KeyD', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(e.code)) {
e.preventDefault(); e.preventDefault();
setKeysPressed(k => ({ ...k, [e.code]: true })); setKeysPressed(k => ({ ...k, [e.code]: true }));