Skip to content

Commit

Permalink
renderMenuItem in ActionMenu checks preventDefault onClose (#1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
VanAnderson committed May 12, 2021
1 parent ff9ce6f commit d78af59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/silver-fans-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/components": patch
---

renderMenuItem in ActionMenu checks preventDefault for conditionally calling onClose
4 changes: 3 additions & 1 deletion src/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ const ActionMenuBase = ({
const actionCallback = itemOnAction ?? onAction
pendingActionRef.current = () => actionCallback?.(props as ItemProps, event)
actionCallback?.(props as ItemProps, event)
onClose()
if (!event.defaultPrevented) {
onClose()
}
}
})
},
Expand Down

1 comment on commit d78af59

@vercel
Copy link

@vercel vercel bot commented on d78af59 May 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.