diff --git a/web/src/App.tsx b/web/src/App.tsx index 0f67f41..3154f91 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -20,6 +20,15 @@ function App() { const UISetting = await fetchNui('AppReady'); setSetting(UISetting); }, 2000); + const keyHandler = (e: KeyboardEvent) => { + if (e.key === 'Escape') { + fetchNui('close'); + } + }; + window.addEventListener('keydown', keyHandler); + return () => { + window.removeEventListener('keydown', keyHandler); + }; } }, [setSetting]); return (