Skip to content

Commit

Permalink
fix(Menu): Pass onClick through even when rendered as a link
Browse files Browse the repository at this point in the history
  • Loading branch information
dougmacknz committed Jul 18, 2024
1 parent 1167f2d commit d3dd991
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/lazy-crabs-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kaizen/components": patch
---

Pass onClick through to MenuItem even when it is rendered as a link
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type MenuItemProps = {
href?: string
// Only applicable if href is supplied above
target?: string
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void
onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void
icon?: JSX.Element
destructive?: boolean
disabled?: boolean
Expand Down Expand Up @@ -70,6 +70,7 @@ export const MenuItem = ({
<a
id={id}
href={href}
onClick={onClick}
className={className}
target={target}
// this tells screenreaders that this link represents the current page
Expand Down

0 comments on commit d3dd991

Please sign in to comment.