diff --git a/src/hemsedal24/components/Popover.tsx b/src/hemsedal24/components/Popover.tsx index 370b339e6..01615265e 100644 --- a/src/hemsedal24/components/Popover.tsx +++ b/src/hemsedal24/components/Popover.tsx @@ -23,17 +23,16 @@ const Popover: React.FC = ({ onClose, children }) => { }; }, [onClose]); - const handleKeyDown = (event: KeyboardEvent) => { + const handleKeyDown = (event: React.KeyboardEvent) => { if (event.key === 'Escape' || event.key === 'Enter') { if (popoverRef.current && !popoverRef.current.contains(event.target as Node)) { onClose(); }} }; - document.addEventListener('keydown', handleKeyDown); return ( <> -
+
{children}