diff --git a/src/pages/Correlation/components/SavedCorrelationsModal.tsx b/src/pages/Correlation/components/SavedCorrelationsModal.tsx index a9f544bc..9d1228ce 100644 --- a/src/pages/Correlation/components/SavedCorrelationsModal.tsx +++ b/src/pages/Correlation/components/SavedCorrelationsModal.tsx @@ -23,6 +23,19 @@ const SavedCorrelationsModal = () => { }, []); const hasNoSavedFilters = _.isEmpty(correlations) || _.isNil(correlations) || fetchCorrelationsError; + useEffect(() => { + const handleKeyPress = (event: { key: string }) => { + if (event.key === 'Escape') { + closeModal(); + } + }; + + window.addEventListener('keydown', handleKeyPress); + + return () => { + window.removeEventListener('keydown', handleKeyPress); + }; + }, []); return ( { closeModal(); }, []); + useEffect(() => { + const handleKeyPress = (event: { key: string }) => { + if (event.key === 'Escape') { + closeModal(); + } + }; + + window.addEventListener('keydown', handleKeyPress); + + return () => { + window.removeEventListener('keydown', handleKeyPress); + }; + }, []); + return (