Skip to content

Commit

Permalink
fix: menu: add htmltype prop to menu item button (#654)
Browse files Browse the repository at this point in the history
* fix: menu: add htmltype prop to menu item button

* chore: menu: update snaps to account for new default property
  • Loading branch information
dkilgore-eightfold authored Jun 26, 2023
1 parent b810ba8 commit 9a6141a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/Menu/MenuItem/MenuItem.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export interface MenuItemButtonProps
* The nested dropdown menu props
*/
dropdownMenuProps?: NestedDropdownMenuProps;
/**
* The button html type.
* @default 'button'
*/
htmlType?: 'button' | 'submit' | 'reset';
/**
* Menu item icon props
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const MenuItemButton: FC<MenuItemButtonProps> = ({
disabled,
dropdownMenuItems,
dropdownMenuProps,
htmlType = 'button',
iconProps,
onClick,
role = 'menuitem',
Expand Down Expand Up @@ -85,6 +86,7 @@ export const MenuItemButton: FC<MenuItemButtonProps> = ({
className={styles.menuItemButton}
disabled={disabled}
tabIndex={tabIndex}
type={htmlType}
{...rest}
onClick={handleOnClick}
role={role}
Expand All @@ -108,6 +110,7 @@ export const MenuItemButton: FC<MenuItemButtonProps> = ({
className={styles.menuOuterButton}
disabled={disabled}
tabIndex={tabIndex}
type={htmlType}
{...rest}
onClick={handleOnClick}
>
Expand Down
6 changes: 6 additions & 0 deletions src/components/Menu/__snapshots__/Menu.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ exports[`Menu Menu is large 1`] = `
class="menu-item-button"
role="menuitem"
tabindex="0"
type="button"
>
<span
aria-hidden="false"
Expand Down Expand Up @@ -86,6 +87,7 @@ exports[`Menu Menu is large 1`] = `
disabled=""
role="menuitem"
tabindex="0"
type="button"
>
<span
class="menu-item-wrapper"
Expand Down Expand Up @@ -272,6 +274,7 @@ exports[`Menu Menu is medium 1`] = `
class="menu-item-button"
role="menuitem"
tabindex="0"
type="button"
>
<span
aria-hidden="false"
Expand Down Expand Up @@ -315,6 +318,7 @@ exports[`Menu Menu is medium 1`] = `
disabled=""
role="menuitem"
tabindex="0"
type="button"
>
<span
class="menu-item-wrapper"
Expand Down Expand Up @@ -501,6 +505,7 @@ exports[`Menu Menu is small 1`] = `
class="menu-item-button"
role="menuitem"
tabindex="0"
type="button"
>
<span
aria-hidden="false"
Expand Down Expand Up @@ -544,6 +549,7 @@ exports[`Menu Menu is small 1`] = `
disabled=""
role="menuitem"
tabindex="0"
type="button"
>
<span
class="menu-item-wrapper"
Expand Down

0 comments on commit 9a6141a

Please sign in to comment.