Skip to content

Commit 491c9fc

Browse files
committed
[dashboard] Ensure that context menus collapse even in Modals by not calling e.stopPropagation() on click events
1 parent 82362cc commit 491c9fc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

components/dashboard/src/components/ContextMenu.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function ContextMenu(props: ContextMenuProps) {
3535
setExpanded(!expanded);
3636
};
3737

38-
const handler = (evt: KeyboardEvent) => {
38+
const keydownHandler = (evt: KeyboardEvent) => {
3939
if (evt.key === "Escape") {
4040
setExpanded(false);
4141
}
@@ -55,11 +55,11 @@ function ContextMenu(props: ContextMenuProps) {
5555
};
5656

5757
useEffect(() => {
58-
window.addEventListener("keydown", handler);
58+
window.addEventListener("keydown", keydownHandler);
5959
window.addEventListener("click", clickHandler);
6060
// Remove event listeners on cleanup
6161
return () => {
62-
window.removeEventListener("keydown", handler);
62+
window.removeEventListener("keydown", keydownHandler);
6363
window.removeEventListener("click", clickHandler);
6464
};
6565
}, []); // Empty array ensures that effect is only run on mount and unmount

components/dashboard/src/components/Modal.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export default function Modal(props: {
7979
"relative bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-6 max-w-lg mx-auto text-left " +
8080
(props.className || "")
8181
}
82-
onClick={(e) => e.stopPropagation()}
8382
>
8483
{props.closeable !== false && (
8584
<div

0 commit comments

Comments
 (0)