From 0d40bbee62338071960f909f659824c8afc2952b Mon Sep 17 00:00:00 2001 From: Jo du Plessis Date: Sat, 15 Jun 2024 06:55:53 +0200 Subject: [PATCH] stop event on the correct condition --- packages/core/src/menu/menu.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/src/menu/menu.tsx b/packages/core/src/menu/menu.tsx index 5abd6de3..4e24206c 100644 --- a/packages/core/src/menu/menu.tsx +++ b/packages/core/src/menu/menu.tsx @@ -192,9 +192,12 @@ export const Menu = (props: MenuProps) => { } const handleKeyDown = (e) => { - e.stopPropagation() const { isEscape } = getKey(e) - if (isEscape && closeFromParentMenuItem) closeFromParentMenuItem() + if (isEscape && closeFromParentMenuItem) { + e.stopPropagation() + e.preventDefault() + closeFromParentMenuItem() + } } useLayoutEffect(() => {