Skip to content

Commit

Permalink
stop event on the correct condition
Browse files Browse the repository at this point in the history
  • Loading branch information
joduplessis committed Jun 15, 2024
1 parent 637a4a8 commit 0d40bbe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit 0d40bbe

Please sign in to comment.