Commit 63b0635 1 parent 16e3a8a commit 63b0635 Copy full SHA for 63b0635
File tree 2 files changed +27
-0
lines changed
Stream/components/Querier
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,19 @@ const SavedCorrelationsModal = () => {
23
23
} , [ ] ) ;
24
24
25
25
const hasNoSavedFilters = _ . isEmpty ( correlations ) || _ . isNil ( correlations ) || fetchCorrelationsError ;
26
+ useEffect ( ( ) => {
27
+ const handleKeyPress = ( event : { key : string } ) => {
28
+ if ( event . key === 'Escape' ) {
29
+ closeModal ( ) ;
30
+ }
31
+ } ;
32
+
33
+ window . addEventListener ( 'keydown' , handleKeyPress ) ;
34
+
35
+ return ( ) => {
36
+ window . removeEventListener ( 'keydown' , handleKeyPress ) ;
37
+ } ;
38
+ } , [ ] ) ;
26
39
27
40
return (
28
41
< Modal
Original file line number Diff line number Diff line change @@ -244,6 +244,20 @@ const SavedFiltersModal = () => {
244
244
closeModal ( ) ;
245
245
} , [ ] ) ;
246
246
247
+ useEffect ( ( ) => {
248
+ const handleKeyPress = ( event : { key : string } ) => {
249
+ if ( event . key === 'Escape' ) {
250
+ closeModal ( ) ;
251
+ }
252
+ } ;
253
+
254
+ window . addEventListener ( 'keydown' , handleKeyPress ) ;
255
+
256
+ return ( ) => {
257
+ window . removeEventListener ( 'keydown' , handleKeyPress ) ;
258
+ } ;
259
+ } , [ ] ) ;
260
+
247
261
return (
248
262
< Modal
249
263
opened = { isSavedFiltersModalOpen }
You can’t perform that action at this time.
0 commit comments