From 3465bf22fcbc34420032e603671867e878146be7 Mon Sep 17 00:00:00 2001 From: Charles de Dreuille Date: Mon, 23 Mar 2026 10:27:37 +0000 Subject: [PATCH] Remove wrapper Signed-off-by: Charles de Dreuille --- packages/ui/src/components/Menu/Menu.tsx | 29 +++++++++---------- packages/ui/src/components/Menu/definition.ts | 2 -- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/packages/ui/src/components/Menu/Menu.tsx b/packages/ui/src/components/Menu/Menu.tsx index 543b4cfdf7..e8de1f6282 100644 --- a/packages/ui/src/components/Menu/Menu.tsx +++ b/packages/ui/src/components/Menu/Menu.tsx @@ -66,6 +66,7 @@ import { isInternalLink } from '../../utils/linkUtils'; import { getNodeText } from '../../analytics/getNodeText'; import { Box } from '../Box'; import { BgReset } from '../../hooks/useBg'; +import { useCallback } from 'react'; // The height will be used for virtualized menus. It should match the size set in CSS for each menu item. const rowHeight = 32; @@ -308,7 +309,7 @@ export const MenuItem = (props: MenuItemProps) => { ); const { classes, iconStart, children, href } = ownProps; - const handleAction = () => { + const handleAction = useCallback(() => { if (href) { const text = restProps['aria-label'] ?? getNodeText(children) ?? String(href); @@ -316,7 +317,7 @@ export const MenuItem = (props: MenuItemProps) => { attributes: { to: String(href) }, }); } - }; + }, [href, restProps, analytics, children]); // External links open in new tab via window.open instead of client-side routing if (href && !isInternalLink(href)) { @@ -332,14 +333,12 @@ export const MenuItem = (props: MenuItemProps) => { window.open(href, '_blank', 'noopener,noreferrer'); }} > -
-
- {iconStart} - {children} -
-
- -
+
+ {iconStart} + {children} +
+
+
); @@ -382,13 +381,11 @@ export const MenuListBoxItem = (props: MenuListBoxItemProps) => { className={classes.root} {...restProps} > -
-
-
- -
- {children} +
+
+
+ {children}
); diff --git a/packages/ui/src/components/Menu/definition.ts b/packages/ui/src/components/Menu/definition.ts index 076e9ce3ae..63c46a24a3 100644 --- a/packages/ui/src/components/Menu/definition.ts +++ b/packages/ui/src/components/Menu/definition.ts @@ -100,7 +100,6 @@ export const MenuItemDefinition = defineComponent()({ styles, classNames: { root: 'bui-MenuItem', - itemWrapper: 'bui-MenuItemWrapper', itemContent: 'bui-MenuItemContent', itemArrow: 'bui-MenuItemArrow', }, @@ -121,7 +120,6 @@ export const MenuListBoxItemDefinition = styles, classNames: { root: 'bui-MenuItemListBox', - itemWrapper: 'bui-MenuItemWrapper', itemContent: 'bui-MenuItemContent', check: 'bui-MenuItemListBoxCheck', },