Skip to content

Commit

Permalink
fix(menu): href not being spread to MenuItem (#2634)
Browse files Browse the repository at this point in the history
* chore: fix href not spread to menu item

* chore: add changeset

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
shleewhite and kodiakhq[bot] committed Aug 24, 2022
1 parent 05ae02d commit ceb26bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/twelve-ducks-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@twilio-paste/menu': patch
'@twilio-paste/core': patch
---

[Menu] fix href not getting passed to MenuItem
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ describe('Menu', () => {
render(<MenuMock />);
const renderedMenuItem = screen.getByTestId('example-menu-anchor');
expect(renderedMenuItem.tagName).toEqual('A');
expect(renderedMenuItem.getAttribute('href')).toEqual('https://google.com');
});

it('should render a menu separator', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/paste-core/components/menu/src/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const StyledMenuItem = React.forwardRef<HTMLDivElement | HTMLAnchorElemen
return (
<Box
{...(href && secureExternalLink(href))}
href={href}
as={href ? 'a' : 'button'}
{...safelySpreadBoxProps(props)}
element={element}
Expand Down

0 comments on commit ceb26bb

Please sign in to comment.