Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit f8942f6

Browse files
authored
Esc key press to close querier modal (#434)
1 parent fe5590b commit f8942f6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/pages/Stream/components/Querier/index.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,20 @@ const QuerierModal = (props: {
107107
}
108108
}, [showQueryBuilder]);
109109

110+
useEffect(() => {
111+
const handleKeyPress = (event: { key: string }) => {
112+
if (event.key === 'Escape') {
113+
onClose();
114+
}
115+
};
116+
117+
window.addEventListener('keydown', handleKeyPress);
118+
119+
return () => {
120+
window.removeEventListener('keydown', handleKeyPress);
121+
};
122+
}, []);
123+
110124
return (
111125
<Modal
112126
opened={showQueryBuilder}

0 commit comments

Comments
 (0)