Skip to content

Commit

Permalink
Esc key press to close querier modal (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koustavd18 authored Jan 23, 2025
1 parent fe5590b commit f8942f6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pages/Stream/components/Querier/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ const QuerierModal = (props: {
}
}, [showQueryBuilder]);

useEffect(() => {
const handleKeyPress = (event: { key: string }) => {
if (event.key === 'Escape') {
onClose();
}
};

window.addEventListener('keydown', handleKeyPress);

return () => {
window.removeEventListener('keydown', handleKeyPress);
};
}, []);

return (
<Modal
opened={showQueryBuilder}
Expand Down

0 comments on commit f8942f6

Please sign in to comment.